Skip to content

Commit 3bc072c

Browse files
Use ensure_clean
1 parent 8454c3f commit 3bc072c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pandas/tests/io/parser/test_python_parser_only.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,10 @@ def test_malformed_skipfooter(python_parser_only):
320320

321321
def test_file_descriptor_leak(python_parser_only):
322322
# GH 31488
323-
parser = python_parser_only
324-
with open("empty.csv", "w"):
325-
pass
326-
327323
proc = psutil.Process()
328-
with pytest.raises(EmptyDataError):
329-
parser.read_csv("empty.csv")
330-
assert not proc.open_files()
324+
parser = python_parser_only
325+
with tm.ensure_clean() as path:
326+
expected = proc.open_files()
327+
with pytest.raises(EmptyDataError):
328+
parser.read_csv(path)
329+
assert proc.open_files() == expected

0 commit comments

Comments
 (0)