-
Notifications
You must be signed in to change notification settings - Fork 235
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
pytest-xdist causes warnings to be emitted when a unit test uses os.fork() #1186
Comments
Recent xdist+execnet has a workaround to ensure xdist runs on the main thread |
This is a longstanding issue with execnet The introduction of execmodels made it possible for pytest to run on non main threads |
why is the thread not showing in |
seems its using the lowlevel primitive |
that's what I thought though I didnt know you could do that from pure python. OK! I think I might have even known about this issue at some point so I'm going to note this , thanks |
i think we should definitively use the high-level ones instead as debugging those is a pain |
i wonder if there was a specific technical reason for how it ended up with lowlevel primitives for threads |
test suite:
Running as
pytest test.py -n1
, output:Per the author of this warning, multithreaded code is never safe if it also spawns using fork (see discussion). However I cannot locate any threads running. Here's an extension of the example that lists out threads running, and I can find none that are not the "main" thread:
conftest.py:
test.py:
run output:
Basically I want to keep using fork() in my test code, since we are running functions inside the tests themselves in processes. Where is pytest-xdist and/or execnet spawning threads exactly (code is pretty opaque) and is this a bug in the python interpreter?
The text was updated successfully, but these errors were encountered: