Closed grigi closed 11 months ago
I'm able to run tests with python 3.12.0 but I get a new warning.
import unittest
class DurationTestCase(unittest.TestCase):
def test_pass(self):
pass
And with Green we get:
> green test_vanilla.py
.
Captured stderr for test_vanilla.DurationTestCase.test_pass
/Users/stephane/.pyenv/versions/3.12.0/lib/python3.12/unittest/case.py:580: RuntimeWarning: TestResult has no addDuration method
warnings.warn("TestResult has no addDuration method",
Ran 1 test in 0.221s using 10 processes
OK (passes=1)
@CleanCut I can probably take a look over the long weekend but if you are around I would like to discuss a few things:
getattr()
bugs similar to the one reported here.This is not necessarily what I would PR, but this patch got the warnings to go away with Python 3.12.0:
--- result.py.orig 2023-11-28 12:33:02
+++ result.py 2023-11-28 12:41:44
@@ -172,6 +172,7 @@
self.stderr_errput = OrderedDict()
self.stream = stream
self.colors = colors
+ self.collectedDurations = []
def recordStdout(self, test, output):
"""
@@ -224,6 +225,17 @@
)
)
del self.stderr_errput[test]
+
+ def addDuration(self, test, elapsed):
+ """
+ Called when a test finished to run, regardless of its outcome.
+
+ Args:
+ test: The test case corresponding to the test method.
+ elapsed: The time represented in seconds, including the
+ execution of cleanup functions.
+ """
+ self.collectedDurations.append((str(test), elapsed))
class ProtoTestResult(BaseTestResult):
@@ -255,6 +267,7 @@
def reinitialize(self):
self.shouldStop = False
self.errors = []
+ self.collectedDurations = []
self.expectedFailures = []
self.failures = []
self.passing = []
@@ -399,6 +412,7 @@
self.shouldStop = False
self.testsRun = 0
# Individual lists
+ self.collectedDurations = []
self.errors = []
self.expectedFailures = []
self.failures = []
Posting here so others can get unstuck while a new release can get published with a full fix.
@sodul Cool! Feel free to open up a PR. 👍
Sidenote: Sorry for the delay(s) in my response(s). I'm going through some major life changes at the moment which are consuming all of my time. I'll try to check in more often, and I welcome all the help I can get.
Hi, I was testing the brand-new-released Py3.12 on common libraries I use, and green is failing to run tests with the following error:
It appears to be related to this change: https://docs.python.org/3.12/whatsnew/3.12.html#configparser
Running the tests with
python -m unittest
works as expected.