Skip to content

More event loop cleanup #1108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions pytest_asyncio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
32 changes: 0 additions & 32 deletions tests/async_fixtures/test_async_fixtures_scope.py

This file was deleted.

9 changes: 0 additions & 9 deletions tests/async_fixtures/test_async_fixtures_with_finalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 0 additions & 10 deletions tests/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
Loading