You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Python v3.12, if the first test (alphabetically) is skipped, running tests will fail the exception: AttributeError: '_XMLTestResult' object has no attribute 'start_time'. Did you mean: 'stop_time'?
Tests run order defaults to alphabetically so this can be reproduced using the example in doc and changing the following line: def test_skipped(self): --> def test_a_skipped(self):
I'm not sure why it works on the older Python versions and not on the newer ones, but the root issue appears to be in the later versions of python if the test is skipped the 'start_time' attribute is never created for the test_result, so when test_finished is called, it assumes that there will always be a start_time attribute on the test_result.
The text was updated successfully, but these errors were encountered:
After more investigation it looks like this is due to a bug in cpython 3.12 (113267). So I'm fine closing this issue.
Maybe it's worth adding a try/catch to avoid the assumption that startTest will always have been called prior to stopTest, but it may also not be worth the effort as this bug has been fixed in later versions of Python (v3.12.2+).
When using Python v3.12, if the first test (alphabetically) is skipped, running tests will fail the exception:
AttributeError: '_XMLTestResult' object has no attribute 'start_time'. Did you mean: 'stop_time'?
at the following line:
unittest-xml-reporting/xmlrunner/result.py
Line 180 in 3a2be20
Tests run order defaults to alphabetically so this can be reproduced using the example in doc and changing the following line:
def test_skipped(self):
-->def test_a_skipped(self):
I'm not sure why it works on the older Python versions and not on the newer ones, but the root issue appears to be in the later versions of python if the test is skipped the 'start_time' attribute is never created for the test_result, so when test_finished is called, it assumes that there will always be a start_time attribute on the test_result.
The text was updated successfully, but these errors were encountered: