pytest-dev / pytest-asyncio

Asyncio support for pytest
https://pytest-asyncio.readthedocs.io
Apache License 2.0
1.43k stars 152 forks source link

Check marker arguments #886

Closed Cito closed 3 months ago

Cito commented 4 months ago

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.

codecov-commenter commented 4 months ago

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 :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MeggyCal commented 1 month ago

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

seifertm commented 1 month ago

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

MeggyCal commented 1 month ago

Hi, I've been debugging https://github.com/redis/redis-py/issues/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.