-
Notifications
You must be signed in to change notification settings - Fork 148
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
Add pytest fixture to clean up the IO loop #471
Comments
If it were a |
@martindurant sorry I wasn't clear. I'm not suggesting we add this fixture to conftest. I'm suggesting we put it in unit_test.py the same way there is the clean fixture. So users of streamz can use that new fixture in their unit tests. I for example use the |
Hi there, we are not 100% sure, but we think we have been tripped by the same issue when conceiving LorryStream. We have been able to work around it by leveraging the pytest-asyncio-cooperative package. A corresponding example test case is demonstrated at 1. With kind regards, Footnotes |
Certainly that would be fine too. Also, a little documentation around this, as linked by @amotl would make sense, for anyone else that might be doing this kind of thing. |
I recently came across this error in my unit tests:
The error doesn't come from streamz, it's from jupyter_core, in this recent change.
But it is triggered because my streamz tests don't clean up properly after them selves.
They leave the global async event loop,
asyncio.get_event_loop()
, in a running state.To fix it I had to add this fixture to my unit tests:
It's a bit similar to the existing
pristine_loop
, but doesn't exactly do the same thing (afaict).I hope this can help any one having similar issues.
The text was updated successfully, but these errors were encountered: