-
Notifications
You must be signed in to change notification settings - Fork 160
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
event_loop teardown prevents cleanup tasks from finishing #91
Comments
Yury Selivanov mentions that asyncio.run() is the correct way to execute async code in Python 3.7. |
Well, the above was tested in Python 3.6, but I'm not sure how pytest-asyncio is being implements and if it's using |
I'm experiencing this as well. The https://github.com/pytest-dev/pytest-asyncio/blob/master/pytest_asyncio/plugin.py#L186 It seems like the fixture should implement something like this before closing: tasks = loop.all_tasks()
loop.run_until_complete(gather(*tasks))
loop.close() |
@amit-traiana thanks for the report and thanks @rmorshea for debugging the issue :) There were a couple of issues related to this behaviour. #235 proposes a solution for this. I'm closing this issue to direct the discussion to #235. |
Thanks! @seifertm |
Hello everyone!
I'm not sure if that's even a
pytest-asyncio
bug, it might go down up toasyncio
, but Im sharing the details in case it is. I'm trying to usepytest-asyncio
withpyppeteer
- a package the wrap Google's Puppetter API and interacts with Chrome. Here's and example test:The following makes
pytest
freeze, or to be exact - the process is sleeping forever while the C methodepoll_wait
is waiting for any interrupt.The following code seems to work-around it:
The difference here is that I do not close the loop, and Python does it for me when the run ends. Adding 'loop.close()
to the fixture, prints an error that
The event loop is already closed`, which might be a hint of what's happening here?The text was updated successfully, but these errors were encountered: