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 <[email protected]>
Tinche
left a comment
There was a problem hiding this comment.
Left suggestions for a couple of typos, looks good overall. A really good change!
Co-authored-by: Tin Tvrtković <[email protected]>
seifertm
left a comment
There was a problem hiding this comment.
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 <[email protected]>
Co-authored-by: Michael Seifert <[email protected]>
|
Thanks, guys! |
Opening this up to get feedback from the maintainers.
With this patch existing users of
pytest-asyncioshould not experience any change in behavior.This exposes a new API
pytest_asyncio.asyncio_fixturethat is intended to be used like this:This PR also adds a
pytest.iniconfiguration value:asyncio_modewhich 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: