Skip to content

Commit b9c5e36

Browse files
committed
TST: remove some test warnings in parser tests
TST: move highmemory test to proper location in c_parser_only xref pandas-dev#16798
1 parent 8d7d3fb commit b9c5e36

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

Diff for: pandas/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def pytest_addoption(parser):
1010
help="skip slow tests")
1111
parser.addoption("--skip-network", action="store_true",
1212
help="skip network tests")
13-
parser.addoption("--run-highmemory", action="store_true",
13+
parser.addoption("--run-high-memory", action="store_true",
1414
help="run high memory tests")
1515
parser.addoption("--only-slow", action="store_true",
1616
help="run only slow tests")
@@ -27,7 +27,7 @@ def pytest_runtest_setup(item):
2727
pytest.skip("skipping due to --skip-network")
2828

2929
if 'high_memory' in item.keywords and not item.config.getoption(
30-
"--run-highmemory"):
30+
"--run-high-memory"):
3131
pytest.skip(
3232
"skipping high memory test since --run-highmemory was not set")
3333

Diff for: pandas/tests/io/parser/c_parser_only.py

+20-6
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,23 @@ def test_read_tarfile(self, tar_suffix):
476476
# iterating through a file-like).
477477
tar_path = os.path.join(self.dirpath, "tar_csv" + tar_suffix)
478478

479-
tar = tarfile.open(tar_path, "r")
480-
data_file = tar.extractfile("tar_data.csv")
481-
482-
out = self.read_csv(data_file)
483-
expected = pd.DataFrame({"a": [1]})
484-
tm.assert_frame_equal(out, expected)
479+
with tarfile.open(tar_path, "r") as tar:
480+
data_file = tar.extractfile("tar_data.csv")
481+
482+
out = self.read_csv(data_file)
483+
expected = pd.DataFrame({"a": [1]})
484+
tm.assert_frame_equal(out, expected)
485+
486+
@pytest.mark.high_memory
487+
def test_bytes_exceed_2gb(self):
488+
"""Read from a "CSV" that has a column larger than 2GB.
489+
490+
GH 16798
491+
"""
492+
if self.low_memory:
493+
pytest.skip("not a high_memory test")
494+
495+
csv = StringIO('strings\n' + '\n'.join(
496+
['x' * (1 << 20) for _ in range(2100)]))
497+
df = self.read_csv(csv, low_memory=False)
498+
assert not df.empty

Diff for: pandas/tests/io/parser/test_parsers.py

-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# -*- coding: utf-8 -*-
22

33
import os
4-
from io import StringIO
5-
6-
import pytest
7-
84
import pandas.util.testing as tm
95

106
from pandas import read_csv, read_table
@@ -28,18 +24,6 @@
2824
from .dtypes import DtypeTests
2925

3026

31-
@pytest.mark.high_memory
32-
def test_bytes_exceed_2gb():
33-
"""Read from a "CSV" that has a column larger than 2GB.
34-
35-
GH 16798
36-
"""
37-
csv = StringIO('strings\n' + '\n'.join(
38-
['x' * (1 << 20) for _ in range(2100)]))
39-
df = read_csv(csv, low_memory=False)
40-
assert not df.empty
41-
42-
4327
class BaseParser(CommentTests, CompressionTests,
4428
ConverterTests, DialectTests,
4529
HeaderTests, IndexColTests,

0 commit comments

Comments
 (0)