pytest-dev / pytest-dev/pytest-asyncio
Turn deprecation of the "scope" keyword argument of the asyncio marker into an error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 207
- Avg merge
- 5h 35m
- Merged PRs (30d)
- 9
Description
Pytest-asyncio deprecated the scope keyword argument of the asyncio marker in favor of loop_scope back in 2024 (commit a40333a). Passing scope=... to @pytest.mark.asyncio currently emits a PytestDeprecationWarning and is silently treated as loop_scope.
The goal of this issue is to follow through with the deprecation and convert the warning into an error, consistent with #1202 and #924.
This is a breaking change that involves a major version bump to pytest-asyncio.
For reference, the relevant code lives in _parse_asyncio_marker (pytest_asyncio/plugin.py), and the behavior is currently covered in tests/markers/test_function_scope.py. The duplicate scope + loop_scope case already raises UsageError, so the error path is partially in place.
Would this fit into the v2.0 milestone alongside the other deprecation follow-throughs? If so, I'd be happy to pick it up.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pytest_asyncio/plugin.py at _parse_asyncio_marker, then read the related cases in tests/markers/test_function_scope.py. Run that test file first and update coverage so passing scope=... to @pytest.mark.asyncio raises an error instead of emitting a PytestDeprecationWarning, while retaining the existing scope plus loop_scope error behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100