File tree Expand file tree Collapse file tree 3 files changed +22
-24
lines changed Expand file tree Collapse file tree 3 files changed +22
-24
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
22
33import os
4- from io import StringIO
5-
6- import pytest
7-
84import pandas .util .testing as tm
95
106from pandas import read_csv , read_table
2824from .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-
4327class BaseParser (CommentTests , CompressionTests ,
4428 ConverterTests , DialectTests ,
4529 HeaderTests , IndexColTests ,
You can’t perform that action at this time.
0 commit comments