fix: own and close pytest-asyncio's "old loop" instead of suppressing… · dexpace/python-sdk@f774300 · GitHub
Skip to content

Commit f774300

Browse files
committed
fix: own and close pytest-asyncio's "old loop" instead of suppressing the leak
Reverts the previous PytestUnraisableExceptionWarning suppression. Tracemalloc identified the source as pytest-asyncio's `_temporary_event_loop_policy` (plugin.py:618) calling `asyncio.get_event_loop()` to capture the "old" loop — which creates a fresh loop (with a backing socketpair) when no loop is current and never closes it. Three sub-exceptions per session: two for the socketpair fds, one for the loop itself. Workspace-root conftest now pre-creates and registers an event loop, then closes it (and any loop pytest-asyncio swapped in) in a session finalizer. The capture call finds our loop instead of conjuring a new one. filterwarnings = ["error"] stays strict — no warning suppression.
1 parent 17bc853 commit f774300

2 files changed

Lines changed: 43 additions & 7 deletions

File tree

‎conftest.py‎

Lines changed: 43 additions & 0 deletions

‎pyproject.toml‎

Lines changed: 0 additions & 7 deletions

0 commit comments

Comments
 (0)