File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ def test_foo():
2626from __future__ import annotations
2727
2828from contextlib import contextmanager
29+ import gc
2930import locale
3031from typing import (
3132 Callable ,
@@ -272,12 +273,13 @@ def file_leak_context() -> Iterator[None]:
272273 try :
273274 yield
274275 finally :
276+ gc .collect ()
275277 flist2 = proc .open_files ()
276278 # on some builds open_files includes file position, which we _dont_
277279 # expect to remain unchanged, so we need to compare excluding that
278280 flist_ex = [(x .path , x .fd ) for x in flist ]
279281 flist2_ex = [(x .path , x .fd ) for x in flist2 ]
280- assert flist2_ex == flist_ex , (flist2 , flist )
282+ assert set ( flist2_ex ) <= set ( flist_ex ) , (flist2 , flist )
281283
282284 conns2 = proc .connections ()
283285 assert conns2 == conns , (conns2 , conns )
You can’t perform that action at this time.
0 commit comments