Skip to content

Commit

Permalink
TST: remove some test warnings in parser tests (pandas-dev#17057)
Browse files Browse the repository at this point in the history
TST: move highmemory test to proper location in c_parser_only

xref pandas-dev#16798
  • Loading branch information
jreback authored and alanbato committed Nov 10, 2017
1 parent bcdda4e commit 2bf68f2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
4 changes: 2 additions & 2 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def pytest_addoption(parser):
help="skip slow tests")
parser.addoption("--skip-network", action="store_true",
help="skip network tests")
parser.addoption("--run-highmemory", action="store_true",
parser.addoption("--run-high-memory", action="store_true",
help="run high memory tests")
parser.addoption("--only-slow", action="store_true",
help="run only slow tests")
Expand All @@ -27,7 +27,7 @@ def pytest_runtest_setup(item):
pytest.skip("skipping due to --skip-network")

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

Expand Down
26 changes: 20 additions & 6 deletions pandas/tests/io/parser/c_parser_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,23 @@ def test_read_tarfile(self, tar_suffix):
# iterating through a file-like).
tar_path = os.path.join(self.dirpath, "tar_csv" + tar_suffix)

tar = tarfile.open(tar_path, "r")
data_file = tar.extractfile("tar_data.csv")

out = self.read_csv(data_file)
expected = pd.DataFrame({"a": [1]})
tm.assert_frame_equal(out, expected)
with tarfile.open(tar_path, "r") as tar:
data_file = tar.extractfile("tar_data.csv")

out = self.read_csv(data_file)
expected = pd.DataFrame({"a": [1]})
tm.assert_frame_equal(out, expected)

@pytest.mark.high_memory
def test_bytes_exceed_2gb(self):
"""Read from a "CSV" that has a column larger than 2GB.
GH 16798
"""
if self.low_memory:
pytest.skip("not a high_memory test")

csv = StringIO('strings\n' + '\n'.join(
['x' * (1 << 20) for _ in range(2100)]))
df = self.read_csv(csv, low_memory=False)
assert not df.empty
16 changes: 0 additions & 16 deletions pandas/tests/io/parser/test_parsers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# -*- coding: utf-8 -*-

import os
from io import StringIO

import pytest

import pandas.util.testing as tm

from pandas import read_csv, read_table
Expand All @@ -28,18 +24,6 @@
from .dtypes import DtypeTests


@pytest.mark.high_memory
def test_bytes_exceed_2gb():
"""Read from a "CSV" that has a column larger than 2GB.
GH 16798
"""
csv = StringIO('strings\n' + '\n'.join(
['x' * (1 << 20) for _ in range(2100)]))
df = read_csv(csv, low_memory=False)
assert not df.empty


class BaseParser(CommentTests, CompressionTests,
ConverterTests, DialectTests,
HeaderTests, IndexColTests,
Expand Down

0 comments on commit 2bf68f2

Please sign in to comment.