Skip to content

Commit c99fe57

Browse files
fahhemasvetlov
authored andcommitted
Check asyncio_mode (cheap) before _is_asyncio_fixture_function
To fix #720
1 parent 581bd29 commit c99fe57

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pytest_asyncio/plugin.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def _preprocess_async_fixtures(
239239
func
240240
):
241241
continue
242-
if not _is_asyncio_fixture_function(func) and asyncio_mode == Mode.STRICT:
242+
if asyncio_mode == Mode.STRICT and not _is_asyncio_fixture_function(func):
243243
# Ignore async fixtures without explicit asyncio mark in strict mode
244244
# This applies to pytest_trio fixtures, for example
245245
continue
@@ -969,9 +969,9 @@ def pytest_pyfunc_call(pyfuncitem: Function) -> object | None:
969969
# fixturedefs. The last entry in the list is closest and the one used.
970970
func = fixtures[-1].func
971971
if (
972-
_is_coroutine_or_asyncgen(func)
972+
asyncio_mode == Mode.STRICT
973+
and _is_coroutine_or_asyncgen(func)
973974
and not _is_asyncio_fixture_function(func)
974-
and asyncio_mode == Mode.STRICT
975975
):
976976
warnings.warn(
977977
PytestDeprecationWarning(

0 commit comments

Comments
 (0)