-
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
Add mechanism for explicit marking of fixtures which should be run with asyncio #125
Add mechanism for explicit marking of fixtures which should be run with asyncio #125
Conversation
This comment has been minimized.
This comment has been minimized.
I'm not a maintainer but have 5 cents to add. I think we need not a bool flag but three-state:
Having default "compat" mode deprecated we notice people switch either to "on" or "off" in their pytest configuration to avoid deprecation warning displayed by pytest. |
@pipermerriam do you want to implement |
@asvetlov yes, but it will be about 2 weeks before I pick this back up. Life and work things taking front seat for a bit and won't be able to focus on this for till then. (won't be offended if anyone takes what I started and moves forward with it) |
I'm personally is overwhelmed as well by my job and fixing CPython 3.8 beta. |
@pipermerriam I had a go at resolving the conflicts, but I'm not sure what needs doing in pytest_asyncio/plugin.py Gentoo are currently having trouble when running the anyio test suite with pytest-asyncio installed |
Codecov Report
@@ Coverage Diff @@
## master #125 +/- ##
==========================================
- Coverage 96.17% 95.59% -0.59%
==========================================
Files 2 2
Lines 157 227 +70
==========================================
+ Hits 151 217 +66
- Misses 6 10 +4
Continue to review full report at Codecov.
|
@asvetlov thanks for taking this on! |
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left suggestions for a couple of typos, looks good overall. A really good change!
Co-authored-by: Tin Tvrtković <tinchester@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Tests shouldn't just break when pytest-asyncio is installed in addition to any other package. The new modes are also more consistent than the current behavior.
I like that we switched from @pytest_asyncio.asyncio_fixture
to the shorter @pytest_asyncio.fixture
. I also appreciate that asyncio_mode=strict
is the new default.
I annotated a few typos and issues in the docs. Other than that: Great job!
Co-authored-by: Michael Seifert <m.seifert@digitalernachschub.de>
Co-authored-by: Michael Seifert <m.seifert@digitalernachschub.de>
Thanks, guys! |
Opening this up to get feedback from the maintainers.
With this patch existing users of
pytest-asyncio
should not experience any change in behavior.This exposes a new API
pytest_asyncio.asyncio_fixture
that is intended to be used like this:This PR also adds a
pytest.ini
configuration value:asyncio_mode
which defaults toTrue
. When set toFalse
, only fixtures with the above mark (as well as a few other conditions) will be run by the asyncio event loop.Some notes: