File tree 3 files changed +22
-24
lines changed
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):
10
10
help = "skip slow tests" )
11
11
parser .addoption ("--skip-network" , action = "store_true" ,
12
12
help = "skip network tests" )
13
- parser .addoption ("--run-highmemory " , action = "store_true" ,
13
+ parser .addoption ("--run-high-memory " , action = "store_true" ,
14
14
help = "run high memory tests" )
15
15
parser .addoption ("--only-slow" , action = "store_true" ,
16
16
help = "run only slow tests" )
@@ -27,7 +27,7 @@ def pytest_runtest_setup(item):
27
27
pytest .skip ("skipping due to --skip-network" )
28
28
29
29
if 'high_memory' in item .keywords and not item .config .getoption (
30
- "--run-highmemory " ):
30
+ "--run-high-memory " ):
31
31
pytest .skip (
32
32
"skipping high memory test since --run-highmemory was not set" )
33
33
Original file line number Diff line number Diff line change @@ -476,9 +476,23 @@ def test_read_tarfile(self, tar_suffix):
476
476
# iterating through a file-like).
477
477
tar_path = os .path .join (self .dirpath , "tar_csv" + tar_suffix )
478
478
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 1
1
# -*- coding: utf-8 -*-
2
2
3
3
import os
4
- from io import StringIO
5
-
6
- import pytest
7
-
8
4
import pandas .util .testing as tm
9
5
10
6
from pandas import read_csv , read_table
28
24
from .dtypes import DtypeTests
29
25
30
26
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
-
43
27
class BaseParser (CommentTests , CompressionTests ,
44
28
ConverterTests , DialectTests ,
45
29
HeaderTests , IndexColTests ,
You can’t perform that action at this time.
0 commit comments