Skip to content

Flaky fail on final test invokes pytest session fixture #128

@robertrmartinez

Description

@robertrmartinez

I have a pytest fixture which runs at the "session" scope. This fixture starts a local web server, and initiates a sauce labs connection. Upon teardown, it stops the server and closes the sauce connection.

When the final test of my test run is a "flaky" test and fails, it acts as if the session is over and calls my fixture tear down.

Then, the flaky test is rerun, which invokes the session fixture once again.

I would like the session fixture to only be called once obviously due to the overhead of having to spin up the server and start the sauce connection again.

This could be a pytest issue, but I figured I would open an issue here as well to see if there is any suggestions or solutions in the works?

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