diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index 309f4497..44fece73 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -685,15 +685,6 @@ def _temporary_event_loop_policy(policy: AbstractEventLoopPolicy) -> Iterator[No yield finally: asyncio.set_event_loop_policy(old_loop_policy) - # When a test uses both a scoped event loop and the event_loop fixture, - # the "_provide_clean_event_loop" finalizer of the event_loop fixture - # will already have installed a fresh event loop, in order to shield - # subsequent tests from side-effects. We close this loop before restoring - # the old loop to avoid ResourceWarnings. - try: - _get_event_loop_no_warn().close() - except RuntimeError: - pass asyncio.set_event_loop(old_loop) diff --git a/tests/async_fixtures/test_async_fixtures_scope.py b/tests/async_fixtures/test_async_fixtures_scope.py deleted file mode 100644 index 6efd7e0a..00000000 --- a/tests/async_fixtures/test_async_fixtures_scope.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -We support module-scoped async fixtures, but only if the event loop is -module-scoped too. -""" - -from __future__ import annotations - -import asyncio - -import pytest - -import pytest_asyncio - - -@pytest.fixture(scope="module") -def event_loop(): - """A module-scoped event loop.""" - loop = asyncio.new_event_loop() - yield loop - loop.close() - - -@pytest_asyncio.fixture(scope="module", loop_scope="module") -async def async_fixture(): - await asyncio.sleep(0.1) - return 1 - - -@pytest.mark.asyncio -async def test_async_fixture_scope(async_fixture): - assert async_fixture == 1 - await asyncio.sleep(0.1) diff --git a/tests/async_fixtures/test_async_fixtures_with_finalizer.py b/tests/async_fixtures/test_async_fixtures_with_finalizer.py index 199ecbca..ac0629cf 100644 --- a/tests/async_fixtures/test_async_fixtures_with_finalizer.py +++ b/tests/async_fixtures/test_async_fixtures_with_finalizer.py @@ -20,15 +20,6 @@ async def test_module_with_get_event_loop_finalizer(port_with_get_event_loop_fin assert port_with_get_event_loop_finalizer -@pytest.fixture(scope="module") -def event_loop(): - """Change event_loop fixture to module level.""" - policy = asyncio.get_event_loop_policy() - loop = policy.new_event_loop() - yield loop - loop.close() - - @pytest_asyncio.fixture(loop_scope="module", scope="module") async def port_with_event_loop_finalizer(request): def port_finalizer(finalizer): diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py index c32ba964..438f49f2 100644 --- a/tests/test_subprocess.py +++ b/tests/test_subprocess.py @@ -7,16 +7,6 @@ import pytest -if sys.platform == "win32": - # The default asyncio event loop implementation on Windows does not - # support subprocesses. Subprocesses are available for Windows if a - # ProactorEventLoop is used. - @pytest.fixture() - def event_loop(): - loop = asyncio.ProactorEventLoop() - yield loop - loop.close() - @pytest.mark.asyncio async def test_subprocess():