-
Notifications
You must be signed in to change notification settings - Fork 59
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
Flaky fail on final test invokes pytest session fixture #128
Comments
I have a similar issue with the following example: class TestFlaky():
When the last test fails, the teardown is triggered, but then the whole sequence of setup->test->teardown is triggered again for the remaining attempts, only for the last test (with param=3). |
Same issue here. A dumb workaround for now is to create a non-flaky dummy test at the end of the module/session scope:
|
currently pytest will call session/module tear-down before flaky can retry the test. Session/Module will be setup again to run retry count. Because of above behaviour when last test fail for given module all the logs are lost for all test-case upto that point since when tear down is called dvs container is destroyed and to run retry instance DVS container is setup up again and logs only belonging to this instance of run are captured and overwrite all previous logs. Workaround to have default dummy pass test case at end always so we avoid module tear-down and setup again. Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
#1395) * As reported by this issue PR#box/flaky#128 currently pytest will call session/module tear-down before flaky can retry the test. Session/Module will be setup again to run retry count. Because of above behaviour when last test fail for given module all the logs are lost for all test-case upto that point since when tear down is called dvs container is destroyed and to run retry instance DVS container is setup up again and logs only belonging to this instance of run are captured and overwrite all previous logs. Workaround to have default dummy pass test case at end always so we avoid module tear-down and setup again. Signed-off-by: Abhishek Dosi <abdosi@microsoft.com> * Fix formating Signed-off-by: Abhishek Dosi <abdosi@microsoft.com> * Added 2 space/blank lines as per review comment Signed-off-by: Abhishek Dosi <abdosi@microsoft.com> * Updated README with flaky issue mention. Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
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?
The text was updated successfully, but these errors were encountered: