-
Notifications
You must be signed in to change notification settings - Fork 137
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
Backend options use_uvloop
throws import error on test runner if uvloop
is not installed
#645
Comments
Are you saying that I read this multiple times and I'm still not sure what you're getting at. |
Yes, using |
I think it should crash though, as otherwise you might think you're running on uvloop although you're not. |
I share the same opinion, but from the documentation and That is why I'm still not sure if this kind of change was supposed to happen between |
There were tons of changes from v3 to v4, and it's possible that a nuance like this slipped through w/o being explicitly documented in the changelog. |
If it's to keep this behaviour, I will open a PR to make it explicitly on the documentation about this |
The documentation does use the words "if available", hinting that it shouldn't produce an error if |
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
AnyIO version
4.1
Python version
3.11
What happened?
Hello !!
I'm working on a library using
anyio
to support asynchronous programming without depending explicitly onasyncio
ortrio
. I'm opening my library to support not only from3.7
but start supporting the newer4
version.While executing the tests with pytest (using
tox
to help me test for v3 and v4) and following the suggestion on the documentation to setup on pytest multiples backends (in my case, I haveasyncio
andasyncio+uvloop
), when running theasyncio+uvloop
it throws a exceptionI was making a little investigation between v3 and v4 code and I found that the code that made possible to use
use_uvloop
as a backend config, while not crashing ifuvloop
is present, or not, while fallback to "probably" the asyncio event loop stopped working.It seems that this error happens only on test run, while executing some examples with production-ready code, everything is working as expected.
With this, I'm not sure if this was supposed to happen between v3 and v4 of
anyio
, but based on the documentation aboutbackend_options
is not clear to me if that behaviour is to keep, or since the major bump, it should have another behaviour.How can we reproduce the bug?
The way to reproduce this behaviour is to have distinct environments, one with
anyio
v3 while the other withanyio
v4.In both environments, they don't have any dependency which install
uvloop
.The text was updated successfully, but these errors were encountered: