Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run GC in file leak check #48294

Merged
merged 2 commits into from
Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pandas/util/_test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def test_foo():
from __future__ import annotations

from contextlib import contextmanager
import gc
import locale
from typing import (
Callable,
Expand Down Expand Up @@ -272,12 +273,13 @@ def file_leak_context() -> Iterator[None]:
try:
yield
finally:
gc.collect()
flist2 = proc.open_files()
# on some builds open_files includes file position, which we _dont_
# expect to remain unchanged, so we need to compare excluding that
flist_ex = [(x.path, x.fd) for x in flist]
flist2_ex = [(x.path, x.fd) for x in flist2]
assert flist2_ex == flist_ex, (flist2, flist)
assert set(flist2_ex) <= set(flist_ex), (flist2, flist)

conns2 = proc.connections()
assert conns2 == conns, (conns2, conns)
Expand Down