Visitar URL original
Warn when passing scope as positional argument · Issue #812 · pytest-dev/pytest-asyncio · GitHub
Skip to content

Warn when passing scope as positional argument #812

Closed

Description

@Cito

Recently I used pytest.mark.asyncio("session") instead of pytest.mark.asyncio(scope="session").

It took me quite a while to find out why the corresponding test was function scoped instead of session scoped.

It would be nice if either the scope could be passed as positional argument as well, or if there would be a helpful warning or error message in that case, instead of silently swallowing the positional argument.

I can contribute a PR for this feature if you let me know which exact behavior you prefer.

Activity

  1. seifertm commented on Jul 15, 2024

    @seifertm
    Contributor

    Good finding!

    Since the purpose of a positional argument is not immediately obvious from the pytest.mark.asyncio name, I think we should force a keyword argument here. I agree that issuing a warning when passing a positional argument is an improvement. If you can (still) find the time, I'd appreciate a PR for this.

  2. added this to the v0.24 milestone on Jul 15, 2024
  3. Cito commented on Jul 18, 2024

    @Cito
    MemberAuthor

    Implemented in PR #886 now with tests for all such cases of mistakes in arguments.

  4. linked a pull request that will close this issueCheck marker arguments #886on Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions