@@ -180,6 +180,9 @@ def load_dfk_session(request, pytestconfig, tmpd_cwd_session):
180
180
config = pytestconfig .getoption ('config' )[0 ]
181
181
182
182
if config != 'local' :
183
+ this_process = psutil .Process ()
184
+ start_fds = this_process .num_fds ()
185
+ logger .error (f"BENC: open fds: { start_fds } " )
183
186
assert threading .active_count () == 1 , "precondition: only one thread can be running before this test: " + repr (threading .enumerate ())
184
187
185
188
spec = importlib .util .spec_from_file_location ('' , config )
@@ -211,6 +214,9 @@ def load_dfk_session(request, pytestconfig, tmpd_cwd_session):
211
214
assert DataFlowKernelLoader ._dfk is None
212
215
213
216
assert threading .active_count () == 1 , "test left threads running: " + repr (threading .enumerate ())
217
+ end_fds = this_process .num_fds ()
218
+ logger .error (f"BENC: end open fds: { end_fds } (vs { start_fds } at start)" )
219
+ assert start_fds == end_fds , "number of open fds changed across test run"
214
220
215
221
else :
216
222
yield
@@ -275,6 +281,12 @@ def load_dfk_local_module(request, pytestconfig, tmpd_cwd_session):
275
281
logger .error (f"BENC: end threads: { threading .active_count ()} " )
276
282
277
283
assert threading .active_count () == 1 , "test left threads running: " + repr (threading .enumerate ())
284
+ end_fds = this_process .num_fds ()
285
+ logger .error (f"BENC: open fds END: { end_fds } " )
286
+ if end_fds > start_fds :
287
+ logger .error (f"Open files (not all fds, though?): { this_process .open_files ()!r} " )
288
+ os .system (f"ls -l /proc/{ os .getpid ()} /fd" )
289
+ pytest .fail ("BENC: number of open fds increased across test" )
278
290
279
291
else :
280
292
yield
0 commit comments