Skip to content

Commit

Permalink
Replace get_event_loop() in conftest.py as deprecated in Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
OCopping committed Nov 19, 2024
1 parent 4f60daa commit 743cdb2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ def fail_test_on_unclosed_tasks(request: FixtureRequest):
"""

fail_count = request.session.testsfailed
loop = asyncio.get_event_loop()
try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()

asyncio.set_event_loop(loop)
loop.set_debug(True)

request.addfinalizer(
Expand Down

0 comments on commit 743cdb2

Please sign in to comment.