23
23
from pandas .compat import is_platform_little_endian
24
24
import pandas
25
25
import pandas .util .testing as tm
26
+ import pandas .util ._test_decorators as td
26
27
from pandas .tseries .offsets import Day , MonthEnd
27
28
import shutil
28
29
import sys
@@ -382,12 +383,11 @@ def decompress_file(self, src_path, dest_path, compression):
382
383
fh .write (f .read ())
383
384
f .close ()
384
385
385
- @pytest .mark .parametrize ('compression' , [None , 'gzip' , 'bz2' , 'xz' ])
386
+ @pytest .mark .parametrize ('compression' , [
387
+ None , 'gzip' , 'bz2' ,
388
+ pytest .param ('xz' , marks = td .skip_if_no_lzma ) # issue 11666
389
+ ])
386
390
def test_write_explicit (self , compression , get_random_path ):
387
- # issue 11666
388
- if compression == 'xz' :
389
- tm ._skip_if_no_lzma ()
390
-
391
391
base = get_random_path
392
392
path1 = base + ".compressed"
393
393
path2 = base + ".raw"
@@ -414,11 +414,11 @@ def test_write_explicit_bad(self, compression, get_random_path):
414
414
df = tm .makeDataFrame ()
415
415
df .to_pickle (path , compression = compression )
416
416
417
- @pytest .mark .parametrize ('ext' , ['' , '.gz' , '.bz2' , '.xz' , '.no_compress' ])
417
+ @pytest .mark .parametrize ('ext' , [
418
+ '' , '.gz' , '.bz2' , '.no_compress' ,
419
+ pytest .param ('.xz' , marks = td .skip_if_no_lzma )
420
+ ])
418
421
def test_write_infer (self , ext , get_random_path ):
419
- if ext == '.xz' :
420
- tm ._skip_if_no_lzma ()
421
-
422
422
base = get_random_path
423
423
path1 = base + ext
424
424
path2 = base + ".raw"
@@ -442,12 +442,11 @@ def test_write_infer(self, ext, get_random_path):
442
442
443
443
tm .assert_frame_equal (df , df2 )
444
444
445
- @pytest .mark .parametrize ('compression' , [None , 'gzip' , 'bz2' , 'xz' , "zip" ])
445
+ @pytest .mark .parametrize ('compression' , [
446
+ None , 'gzip' , 'bz2' , "zip" ,
447
+ pytest .param ('xz' , marks = td .skip_if_no_lzma )
448
+ ])
446
449
def test_read_explicit (self , compression , get_random_path ):
447
- # issue 11666
448
- if compression == 'xz' :
449
- tm ._skip_if_no_lzma ()
450
-
451
450
base = get_random_path
452
451
path1 = base + ".raw"
453
452
path2 = base + ".compressed"
@@ -466,12 +465,11 @@ def test_read_explicit(self, compression, get_random_path):
466
465
467
466
tm .assert_frame_equal (df , df2 )
468
467
469
- @pytest .mark .parametrize ('ext' , ['' , '.gz' , '.bz2' , '.xz' , '.zip' ,
470
- '.no_compress' ])
468
+ @pytest .mark .parametrize ('ext' , [
469
+ '' , '.gz' , '.bz2' , '.zip' , '.no_compress' ,
470
+ pytest .param ('.xz' , marks = td .skip_if_no_lzma )
471
+ ])
471
472
def test_read_infer (self , ext , get_random_path ):
472
- if ext == '.xz' :
473
- tm ._skip_if_no_lzma ()
474
-
475
473
base = get_random_path
476
474
path1 = base + ".raw"
477
475
path2 = base + ext
0 commit comments