This repository was archived by the owner on Jul 10, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import asyncio
2- import contextlib
31import os
42import re
53import shlex
@@ -328,23 +326,3 @@ def log_test_start_and_end(request):
328326 logging .console .info (f"🏁[green]Testing[/green] [yellow]{ test_name } [/yellow]" )
329327 yield
330328 logging .console .success (f"✅ [green]Finished[/green] [yellow]{ test_name } [/yellow]" )
331-
332-
333- @pytest_asyncio .fixture (scope = "session" )
334- def event_loop ():
335- """Create an instance of the default event loop for each test case and close all alive tasks at the end."""
336- loop = asyncio .get_event_loop ()
337- yield loop
338-
339- # 1) cance all alive tasks
340- pending = [t for t in asyncio .all_tasks (loop ) if not t .done ()]
341- for t in pending :
342- t .cancel ()
343- with contextlib .suppress (Exception ):
344- loop .run_until_complete (asyncio .gather (* pending , return_exceptions = True ))
345-
346- # 2) cleanup async generators
347- with contextlib .suppress (Exception ):
348- loop .run_until_complete (loop .shutdown_asyncgens ())
349-
350- loop .close ()
Original file line number Diff line number Diff line change 11[pytest]
22filterwarnings = ignore::DeprecationWarning:pkg_resources.*:
33asyncio_default_fixture_loop_scope = session
4+ asyncio_default_test_loop_scope = session
45addopts = -s
You can’t perform that action at this time.
0 commit comments