Commit f774300
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 46 | | |
54 | 47 | | |
55 | 48 | | |
| |||
0 commit comments