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

TST: remove some test warnings in parser tests #17057

Merged
merged 1 commit into from
Jul 23, 2017
Merged
Show file tree
Hide file tree
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: 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