Skip to content

Exception no attribute 'start_time' if first test is skipped (Py v3.12) #286

Closed
@mwhavens

Description

@mwhavens

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:

self.test_result.stop_time - self.test_result.start_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions