-
Notifications
You must be signed in to change notification settings - Fork 230
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
--maxfail
does not work correctly
#868
Comments
Xdist uses multiple processes setup has to happen in each process, no way around that |
Thank you for your reply! I am not sure if we are on the same page:
|
i have to croscheck, but i belive this may be a distributed systems effect as more than one test id was send to the process, it runs both in addition there are teardown timeouts involved, so pytest-xdist might be shutting down a unresponsive worker that still in the sleep i recommend testing with much smaller times for the behaviour and then upping the numbes until it crumbles, im currently out of the details of the proocess termination behaviour and wont be able to dig into it myself in near future so basically while the second setup runs on the worker the coordinator sends the command to shutdown |
Thank you for the recommendation!
That makes sense – but what is the explanation for the fact that the Do you think that we could achieve the intended behaviour with figures?
|
currently it is not possible to stop the execution of a second test after the first failed due to the current behaviour details on teardown need to be verified with how xdist itself shuts down |
We noticed an issue with
pytest-xdist
in combination with--maxfail>0
.It is related to #420, but goes even further.
For some reason,
tearDownClass
is not executed completely at the end of a failed test.This is an example TestCase where the issue occurs:
Results without pytest-xdist: pytest --maxfail=1 -s --log-cli-level=INFO test_test.py
Results with pytest-xdist: pytest -n 1 --dist loadscope --maxfail=1 -s --log-cli-level=INFO test_test.py
(Executing with this trick to make logs visible)
As you can see in the logs, pytest usually (without pytest-xdist) executes
setUp
only once and then executestearDownClass
until its completion in the end.Contrary to this, with pytest-xdist,
setUp
is executed twice: The first time until it is finished, and the second time it is aborted. Moreover,tearDownClass
is started, but aborted.Is this expected behavior? If yes, is this behavior documented somewhere? Do you have any recommendations on how to fix the issue?
The most important point for us would be to always execute
tearDownClass
fully in the end.(It would also be good if
setUp
would only be executed once).The text was updated successfully, but these errors were encountered: