Commit 009f481
iris: auto-cleanup managed threads in tests via thread_container_scope
Tests that construct Controller but never call controller.stop() were
leaking the log-server uvicorn thread (and other managed threads registered
with the process-wide default ThreadContainer). These non-daemon threads
survived the test and were dumped by pytest_sessionfinish.
Wrap the autouse _thread_cleanup fixture with thread_container_scope() so
every iris test runs with a fresh ThreadContainer that is stopped on
teardown. The container's stop() signals server.should_exit on any
spawn_server threads and joins them. The existing thread-snapshot leak
warning remains as a safety net for threads created outside any container.
Fixes #4871.
Co-authored-by: Russell Power <rjpower@users.noreply.github.com>1 parent 8400841 commit 009f481
1 file changed
Lines changed: 15 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | | - | |
| 125 | + | |
| 126 | + | |
122 | 127 | | |
123 | 128 | | |
124 | 129 | | |
| |||
0 commit comments