Skip to content

Turn deprecation of the "scope" keyword argument of the asyncio marker into an error #1475

@SaInekK

Description

@SaInekK

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions