-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stopTest issue with Python 3.12.1 and skipped tests #277
Comments
We should be able to check if |
For the short term that should work. Something I was thinking about looking into is to have the classes used by green to inherit from the official classes so that they will be more future proof. But I would do that after cleaning up the code from all pre 3.8 support to get the codebase cleaned up and organized. |
My plan is to get v4.0.0 released based of the current main in the next few days so that we can have support for python 3.12.0 with a note that 3.12.1 is known to break on skipped tests. This should allow most users of green to be able to use green with python 3.12 while I work on fixing the skipped tests issue. I will probably release v4.1.0 a few days later with this issue fixed. |
I've released Green 4.0.0 with python 3.12 support. Now that the minimal python version is 3.8 I should be able to refactor the code more easily and will work on the 3.12.1 compatibility issue this week. |
I made some progress on this issue. I added a test with the skip annotation to reproduce the bug and I'm able to run
And:
After looking at I had to add some type annotation to help me track things, but this is triggering some cascading error reporting and I do not want to fix everything at once here. |
It seems that it is having an issue with the tests in |
My original idea to have green's BaseTestResult class inherit from unittest.TestResult seems to get the tests to freeze on the internal tests with macOS and Windows, but not in Linux according to GH actions. I'll shelve this for now and will re-implement the new attributes added in Python 3.12.1 as a short term fix. Longer term I do believe inheriting is the proper approach but we will need refactor the internal queueing code of green to properly identify where the race condition occurs. Thanks to mypy some issues have been uncovered but it will take some time to implement all this refactoring. |
I think it would be great to mostly inherit and/or use upstream implementations. I tried to do that as much as I could...but it wouldn't work in a lot of places. Maybe it will work better now. |
There is something odd with the |
Ya, the queue communication has always been super finicky and hard to debug. Any improvements to that (or to the surrounding architecture) are most welcome. |
For reference I did a diff of the unittest folder in python 3.12.0 and 3.12.1 to help me better understand what the actual changes are:
Taking the unittest folder from py3.12.0 and putting it in 3.12.1 seems to help. This is good because this should help with getting to the root of the issue. |
I have encouraging news! Python 3.12.2 was released yesterday and the bug fixes include changes to the unittests package. Since pyenv does not support it yet I took the unittest folder from 3.12.2 and placed it inside a 3.12.1 install and green started to work again on skipped tests:
The diff is pretty small so I might be able to add custom logic just for 3.12.1, or we can just flag 3.12.1 as incompatible with green.
|
This is the bug report on the CPython side: python/cpython#113267 |
That would be my vote, but I'll let you decide. |
I'm waiting for pyenv and GH actions to both provide 3.12.2 and then I will update the GH actions, documentation and the toml file to mark 3.12.1 incompatible. There is no rush since pypi.org and pip do not make it easy to update older releases to reflect compatibility conflicts unfortunately. |
We have a unittest that is decorated with
@unittest.skipIf(...)
, and when green is collecting tests results instopTest()
we get anAttributeError
forstart_time
on this line:self.test_time = str(time.time() - self.start_time)
.Since
self.start_time
is being set instartTest()
but this seems to be skipped on skipped tests, butstopTest()
is still being called, it looks like it is a new compatibility issue.If I silence the AttributeError, we get an other one later on
proto_test_result.errors
inaddProtoTestResult()
, so the fix might get tricky.I will take a look at a permanent fix after 3.5.0 gets released. For new we have commented out the skipped test in our codebase so we can use 3.12.1.
https://docs.python.org/3/whatsnew/changelog.html#python-3-12-1-final
I suspect it might be caused by this change: python/cpython#109725
The text was updated successfully, but these errors were encountered: