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
Treating the "coroutine was never awaited" RuntimeWarning as an error #184
Comments
I think you need to use pytest.ini's |
@graingert Oh, you actually introduced I see now that this issue is related to pytest-dev/pytest#5299 I'll try to write a plugin for it or something, I've not worked with pytest internals before so it will take some time. |
@puddly my need for this feature is now more pressing, have you got something I can collaborate on? |
Here's my quick in-tree implementation of it: puddly@9957292 I'll have to investigate how to wrap the required changes into a plugin but it works for my trivial unit test. |
I've implemented this as a separate plugin https://github.com/puddly/pytest-unraisable/ |
Here's a simple test case:
And how I setup my test environment:
$ python3.8 -m venv venv $ source venv/bin/activate (venv) $ pip install pytest pytest-asyncio
If you try running
pytest
normally, it logs a warning:However, passing
-Werror
silences it completely:I'm trying to get this test case to fail. The
with warnings.catch_warnings(): ...
context manager doesn't work either because I think it needs to be around the call toloop.run_until_complete()
call.Am I misconfiguring something?
The text was updated successfully, but these errors were encountered: