Skip to content

Commit e3cb9c1

Browse files
committed
Add unit test plus '--high-memory' option, *off by default*.
1 parent 2ab4971 commit e3cb9c1

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

pandas/conftest.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ def pytest_addoption(parser):
99
parser.addoption("--skip-slow", action="store_true",
1010
help="skip slow tests")
1111
parser.addoption("--skip-network", action="store_true",
12-
help="run network tests")
12+
help="skip network tests")
13+
parser.addoption("--run-highmemory", action="store_true",
14+
help="run high memory tests")
1315
parser.addoption("--only-slow", action="store_true",
1416
help="run only slow tests")
1517

@@ -24,6 +26,9 @@ def pytest_runtest_setup(item):
2426
if 'network' in item.keywords and item.config.getoption("--skip-network"):
2527
pytest.skip("skipping due to --skip-network")
2628

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

2833
# Configurations for all tests and all test modules
2934

pandas/tests/io/parser/test_parsers.py

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

33
import os
4+
from io import StringIO
5+
6+
import pytest
47

58
import pandas.util.testing as tm
69

@@ -24,6 +27,16 @@
2427
from .python_parser_only import PythonParserTests
2528
from .dtypes import DtypeTests
2629

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

2841
class BaseParser(CommentTests, CompressionTests,
2942
ConverterTests, DialectTests,

0 commit comments

Comments
 (0)