You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been troubleshooting for the past days an issue which puzzles me...
Our app spawns some suprocesses, and I was having some random failures either in setup of teardown of my pytest-asyncio test cases.
This is the very minimal code to reproduce, after removing everything else:
importasyncioimportpytestimportsys@pytest.mark.parametrize('attempt', range(100))@pytest.mark.asyncioasyncdeftest_subprocess(attempt):
# Initialise a lot of stuff, including a subprocesstransport, _=awaitasyncio.get_event_loop().subprocess_exec(
asyncio.SubprocessProtocol, sys.executable
)
# Close everything, including our previous transporttransport.close()
My first random guess would be some late cleanup code which would corrupt the next event loop associated with next test... especially because if I wait a bit after closing, or await transport._wait(), the problem disappears.
The problem appears when running multiple pytest-asyncio testcase in a row, but does not appear at all if the loop remains untouched, which is the case in our app. I can work around this situation in various ways, but I'm wondering if the test fixture could not protect from this kind of errors instead???
Note that the issue appears mainly on Ubuntu in my case, which I can hardly reproduce it on mac os.
@RouquinBlanc Thanks for the report and the minimal example!
I cannot reproduce the issue using pytest-asyncio 0.17.0. I consistently get 100 successful tests on my Linux machine. Possibly the issue has been resolved.
If you continue to experience problems with a more recent version of pytest-asyncio feel free to reopen this issue.
Hi,
I've been troubleshooting for the past days an issue which puzzles me...
Our app spawns some suprocesses, and I was having some random failures either in setup of teardown of my pytest-asyncio test cases.
This is the very minimal code to reproduce, after removing everything else:
My first random guess would be some late cleanup code which would corrupt the next event loop associated with next test... especially because if I wait a bit after closing, or
await transport._wait()
, the problem disappears.The problem appears when running multiple pytest-asyncio testcase in a row, but does not appear at all if the loop remains untouched, which is the case in our app. I can work around this situation in various ways, but I'm wondering if the test fixture could not protect from this kind of errors instead???
Note that the issue appears mainly on Ubuntu in my case, which I can hardly reproduce it on mac os.
Test output here
The text was updated successfully, but these errors were encountered: