Skip to content

Commit f0613c1

Browse files
committed
refactor: Stop marking event loops with a custom attribute.
There's no longer a need to identify event loops provided by pytest-asyncio.
1 parent 64c9ccb commit f0613c1

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

pytest_asyncio/plugin.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import socket
1212
import sys
1313
import warnings
14-
from asyncio import AbstractEventLoop, AbstractEventLoopPolicy
14+
from asyncio import AbstractEventLoopPolicy
1515
from collections.abc import (
1616
AsyncIterator,
1717
Awaitable,
@@ -798,11 +798,6 @@ def pytest_generate_tests(metafunc: Metafunc) -> None:
798798
)
799799

800800

801-
def _make_pytest_asyncio_loop(loop: AbstractEventLoop) -> AbstractEventLoop:
802-
loop.__pytest_asyncio = True # type: ignore[attr-defined]
803-
return loop
804-
805-
806801
def _get_event_loop_no_warn(
807802
policy: AbstractEventLoopPolicy | None = None,
808803
) -> asyncio.AbstractEventLoop:
@@ -996,12 +991,6 @@ def _function_event_loop(
996991
@contextlib.contextmanager
997992
def _provide_event_loop() -> Iterator[asyncio.AbstractEventLoop]:
998993
loop = asyncio.get_event_loop_policy().new_event_loop()
999-
# Add a magic value to the event loop, so pytest-asyncio can determine if the
1000-
# event_loop fixture was overridden. Other implementations of event_loop don't
1001-
# set this value.
1002-
# The magic value must be set as part of the function definition, because pytest
1003-
# seems to have multiple instances of the same FixtureDef or fixture function
1004-
loop = _make_pytest_asyncio_loop(loop)
1005994
try:
1006995
yield loop
1007996
finally:

0 commit comments

Comments
 (0)