-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
warn when the type hint of an async generator is not AsyncGenerator #233
Comments
Sure, why not 🙂 Although I'll note that even if you correctly use |
I see two different ways of implementing this:
1 is significantly simpler to implement, avoids false positives, and sounds like it resolves the issue just as well? Whereas the title of the issue implies 2. |
(1) fails for functions which return a I'd treat this as a distinctly low priority issue since it's nontrivial to implement and I prefer to ban async generators anyway, but no objection if someone wants to contribute it. |
This should probably not trigger for functions decorated with |
Not if you're using pytest-trio - the yield can raise trio.Cancelled https://pytest-trio.readthedocs.io/en/stable/reference.html#an-important-note-about-yield-fixtures
This means the fixture function needs to return something with |
That sounds like a severe bug in pytest-trio. |
No, that seems fine to me? The docs are a bit odd, but this is just like applying |
Typing an async generator as AsyncIterator or AsyncIterable prevents wrapping it with contextlib.aclosing
The text was updated successfully, but these errors were encountered: