File tree 1 file changed +3
-1
lines changed
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ def test_foo():
26
26
from __future__ import annotations
27
27
28
28
from contextlib import contextmanager
29
+ import gc
29
30
import locale
30
31
from typing import (
31
32
Callable ,
@@ -272,12 +273,13 @@ def file_leak_context() -> Iterator[None]:
272
273
try :
273
274
yield
274
275
finally :
276
+ gc .collect ()
275
277
flist2 = proc .open_files ()
276
278
# on some builds open_files includes file position, which we _dont_
277
279
# expect to remain unchanged, so we need to compare excluding that
278
280
flist_ex = [(x .path , x .fd ) for x in flist ]
279
281
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 )
281
283
282
284
conns2 = proc .connections ()
283
285
assert conns2 == conns , (conns2 , conns )
You can’t perform that action at this time.
0 commit comments