Commit 72b47e7
committed
[#1354] Close pytest rerun socket resources during xdist runs
Add local pytest cleanup for ResourceWarning messages emitted when running the
test suite with pytest-xdist and pytest-rerunfailures. The rerunfailures plugin
creates localhost sockets to coordinate rerun state between the xdist controller
and workers, but version 16.1 does not close all of those sockets before Python
interpreter shutdown.
Update src/conftest.py to close the plugin-owned failures_db socket during
pytest_unconfigure(). Also wrap pytest-rerunfailures ServerStatusDB connection
handling so accepted server-side sockets are closed when their handler exits.
This preserves rerunfailures behavior while preventing unclosed socket warnings
during parallel pytest runs.
Also keep reportconf.py loading inside a context manager so pytest-html report
configuration does not leave an open file handle.
Verified with:
- pytest -q -n 2 src/architecture/messaging/_UnitTest/test_CMsgTimeWritten.py
- pytest -q -n 2 src/simulation/environment/spiceInterface/_UnitTest/test_spiceThreadSafety.py
- pytest -n auto from src1 parent 714192b commit 72b47e7
1 file changed
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
38 | 71 | | |
39 | 72 | | |
40 | 73 | | |
| |||
71 | 104 | | |
72 | 105 | | |
73 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
74 | 118 | | |
75 | 119 | | |
76 | 120 | | |
| |||
0 commit comments