Skip to content
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

Check marker arguments #886

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Conversation

Cito
Copy link
Member

@Cito Cito commented Jul 18, 2024

This PR implements error checking for the arguments of mark.asyncio.

An ValueError with a helpful message is raised when unexpected arguments are passed.

This should fix issue #812.

@Cito Cito changed the title Check marker arguments (fixes #812) Check marker arguments Jul 18, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 91.50%. Comparing base (a8b3d18) to head (db7a1c6).
Report is 2 commits behind head on main.

Files Patch % Lines
pytest_asyncio/plugin.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #886      +/-   ##
==========================================
- Coverage   91.86%   91.50%   -0.37%     
==========================================
  Files           2        2              
  Lines         504      506       +2     
  Branches       99      100       +1     
==========================================
  Hits          463      463              
- Misses         24       25       +1     
- Partials       17       18       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

docs: Added changelog entry for error for positional asyncio marker arguments.
@seifertm seifertm force-pushed the check-marker-arguments branch from deecec7 to db7a1c6 Compare July 30, 2024 13:22
Copy link
Contributor

@seifertm seifertm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

I rebased the code to main and adjusted the tests to use the new loop_scope kwargs rather than the deprecated scope kwarg to @pytest.mark.asyncio.

I also added a changelog entry.

@seifertm seifertm enabled auto-merge July 30, 2024 13:24
@seifertm seifertm linked an issue Jul 30, 2024 that may be closed by this pull request
@seifertm seifertm added this pull request to the merge queue Jul 30, 2024
Merged via the queue into pytest-dev:main with commit a07d5b9 Jul 30, 2024
17 checks passed
@MeggyCal
Copy link

MeggyCal commented Oct 9, 2024

As this error is thrown at every unrecognized keyword argument, could it be improved to something more generic, please?

@seifertm
Copy link
Contributor

@MeggyCal What problem are you encountering and what improvement do you suggest to solve it?

@MeggyCal
Copy link

Hi, I've been debugging redis/redis-py#3339 lately. I find mark.asyncio accepts only a keyword argument 'scope' cryptic at this point, it would be better to throw mark.asyncio: Unrecognized keyword argument: %s or mark.asyncio does not accept positional arguments. Did you mean to use 'scope'? depending on the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn when passing scope as positional argument
4 participants