Skip to content

Commit 8d1c168

Browse files
Made the test non-python parser specific
1 parent 5b489ca commit 8d1c168

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

pandas/tests/io/parser/test_common.py

+12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from urllib.error import URLError
1212

1313
import numpy as np
14+
import psutil
1415
import pytest
1516

1617
from pandas._libs.tslib import Timestamp
@@ -2079,3 +2080,14 @@ def test_integer_precision(all_parsers):
20792080
result = parser.read_csv(StringIO(s), header=None)[4]
20802081
expected = Series([4321583677327450765, 4321113141090630389], name=4)
20812082
tm.assert_series_equal(result, expected)
2083+
2084+
2085+
def test_file_descriptor_leak(all_parsers):
2086+
# GH 31488
2087+
proc = psutil.Process()
2088+
parser = all_parsers
2089+
with tm.ensure_clean() as path:
2090+
expected = proc.open_files()
2091+
with pytest.raises(EmptyDataError, match="No columns to parse from file"):
2092+
parser.read_csv(path)
2093+
assert proc.open_files() == expected

pandas/tests/io/parser/test_python_parser_only.py

+1-13
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
import csv
99
from io import BytesIO, StringIO
1010

11-
import psutil
1211
import pytest
1312

14-
from pandas.errors import EmptyDataError, ParserError
13+
from pandas.errors import ParserError
1514

1615
from pandas import DataFrame, Index, MultiIndex
1716
import pandas._testing as tm
@@ -315,14 +314,3 @@ def test_malformed_skipfooter(python_parser_only):
315314
msg = "Expected 3 fields in line 4, saw 5"
316315
with pytest.raises(ParserError, match=msg):
317316
parser.read_csv(StringIO(data), header=1, comment="#", skipfooter=1)
318-
319-
320-
def test_file_descriptor_leak(python_parser_only):
321-
# GH 31488
322-
proc = psutil.Process()
323-
parser = python_parser_only
324-
with tm.ensure_clean() as path:
325-
expected = proc.open_files()
326-
with pytest.raises(EmptyDataError, match="No columns to parse from file"):
327-
parser.read_csv(path)
328-
assert proc.open_files() == expected

0 commit comments

Comments
 (0)