Commit b80a9bd
committed
Force per-test GC so leaked-stream warnings stay inside the scoped filters
The module-level filterwarnings marks only apply while a test in this file
is the active warning context, but v1's leaked memory streams sit in
reference cycles and were garbage-collected later: at pytest's
session-unconfigure unraisable sweep (every test in this file passed but
pytest exited 1 when run without xdist, e.g. -n 0 for --pdb debugging), or
during an unrelated test on the same worker, where the global
filterwarnings = ["error"] turned the deallocator warning into a failure
of that innocent test.
An autouse fixture now runs gc.collect() in each test's teardown, so the
deallocator warnings fire where the scoped ignores apply. Verified: every
previously failing single-test and full-file -n 0 invocation now exits 0,
and cross-file runs no longer misattribute the warnings.1 parent 43cf9ec commit b80a9bd
1 file changed
Lines changed: 19 additions & 1 deletion
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
73 | 91 | | |
74 | 92 | | |
75 | 93 | | |
| |||
0 commit comments