Skip to content

Commit

Permalink
Check asyncio_mode (cheap) before _is_asyncio_fixture_function
Browse files Browse the repository at this point in the history
To fix #720
  • Loading branch information
fahhem authored and asvetlov committed Dec 30, 2024
1 parent 581bd29 commit c99fe57
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pytest_asyncio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def _preprocess_async_fixtures(
func
):
continue
if not _is_asyncio_fixture_function(func) and asyncio_mode == Mode.STRICT:
if asyncio_mode == Mode.STRICT and not _is_asyncio_fixture_function(func):
# Ignore async fixtures without explicit asyncio mark in strict mode
# This applies to pytest_trio fixtures, for example
continue
Expand Down Expand Up @@ -969,9 +969,9 @@ def pytest_pyfunc_call(pyfuncitem: Function) -> object | None:
# fixturedefs. The last entry in the list is closest and the one used.
func = fixtures[-1].func
if (
_is_coroutine_or_asyncgen(func)
asyncio_mode == Mode.STRICT
and _is_coroutine_or_asyncgen(func)
and not _is_asyncio_fixture_function(func)
and asyncio_mode == Mode.STRICT
):
warnings.warn(
PytestDeprecationWarning(
Expand Down

0 comments on commit c99fe57

Please sign in to comment.