-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Can not run a subprocess in a test: "the child watcher does not have a loop attached" #2058
Comments
@asvetlov is it possible that it is because the current loop is set to None when running the test? https://github.com/aio-libs/aiohttp/blob/master/aiohttp/test_utils.py#L442 I have no idea why we put that to None but setting it to loop fixes the issue. Should I make a PR? |
The PR fixes an issue I was seeing trying to use a pytest-aiohttp event loop to test a function using |
@kblin yw \o/ As I explained there: #1946 (comment) You really don't need I'm using ayncio's subprocesses in my application so when I test it it runs under the test loop and that's how I ran into that problem. |
Same here, I'm calling an external tool in the function that I wanted to test. |
Fixed by #2075 |
Long story short
The loop created for the testing purpose doesn't allow you to spawn subprocesses using
asyncio.create_subprocess_*
.Expected behaviour
You can spawn subprocesses without problem like you would do with a default loop.
Actual behaviour
When you try to spawn a subprocess, you automatically get:
Steps to reproduce
Your environment
Arch Linux, Python 3.6
The text was updated successfully, but these errors were encountered: