Skip to content

Commit 04f9044

Browse files
committed
refactor: Replace the "__original_fixture_loop" magic attribute with the more generic "__pytest_asyncio" magic attribute.
1 parent dafef6c commit 04f9044

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytest_asyncio/plugin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ def pytest_fixture_setup(
861861
# Weird behavior was observed when checking for an attribute of FixtureDef.func
862862
# Instead, we now check for a special attribute of the returned event loop
863863
fixture_filename = inspect.getsourcefile(fixturedef.func)
864-
if not getattr(loop, "__original_fixture_loop", False):
864+
if not _is_pytest_asyncio_loop(loop):
865865
_, fixture_line_number = inspect.getsourcelines(fixturedef.func)
866866
warnings.warn(
867867
_REDEFINED_EVENT_LOOP_FIXTURE_WARNING
@@ -1154,7 +1154,7 @@ def event_loop(request: FixtureRequest) -> Iterator[asyncio.AbstractEventLoop]:
11541154
# set this value.
11551155
# The magic value must be set as part of the function definition, because pytest
11561156
# seems to have multiple instances of the same FixtureDef or fixture function
1157-
loop.__original_fixture_loop = True # type: ignore[attr-defined]
1157+
loop = _make_pytest_asyncio_loop(loop)
11581158
yield loop
11591159
loop.close()
11601160

0 commit comments

Comments
 (0)