File tree Expand file tree Collapse file tree 6 files changed +9
-19
lines changed
Expand file tree Collapse file tree 6 files changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -83,8 +83,8 @@ def test_path_pathlib(self):
8383 df = pd .read_sas (fname , encoding = 'utf-8' )
8484 tm .assert_frame_equal (df , df0 )
8585
86+ @td .skip_if_no ('py.path' )
8687 def test_path_localpath (self ):
87- tm ._skip_if_no_localpath ()
8888 from py .path import local as LocalPath
8989 for j in 0 , 1 :
9090 df0 = self .data [j ]
Original file line number Diff line number Diff line change @@ -75,9 +75,8 @@ def test_stringify_path_pathlib(self):
7575 redundant_path = common ._stringify_path (Path ('foo//bar' ))
7676 assert redundant_path == os .path .join ('foo' , 'bar' )
7777
78+ @td .skip_if_no ('py.path' )
7879 def test_stringify_path_localpath (self ):
79- tm ._skip_if_no_localpath ()
80-
8180 path = os .path .join ('foo' , 'bar' )
8281 abs_path = os .path .abspath (path )
8382 lpath = LocalPath (path )
Original file line number Diff line number Diff line change @@ -665,11 +665,10 @@ def test_read_from_pathlib_path(self):
665665
666666 tm .assert_frame_equal (expected , actual )
667667
668+ @td .skip_if_no ('py.path' )
668669 def test_read_from_py_localpath (self ):
669670
670671 # GH12655
671- tm ._skip_if_no_localpath ()
672-
673672 from py .path import local as LocalPath
674673
675674 str_path = os .path .join (self .dirpath , 'test1' + self .ext )
Original file line number Diff line number Diff line change @@ -5119,11 +5119,10 @@ def test_read_nokey_empty(self):
51195119 store .close ()
51205120 pytest .raises (ValueError , read_hdf , path )
51215121
5122+ @td .skip_if_no ('pathlib' )
51225123 def test_read_from_pathlib_path (self ):
51235124
51245125 # GH11773
5125- tm ._skip_if_no_pathlib ()
5126-
51275126 from pathlib import Path
51285127
51295128 expected = DataFrame (np .random .rand (4 , 5 ),
@@ -5137,11 +5136,10 @@ def test_read_from_pathlib_path(self):
51375136
51385137 tm .assert_frame_equal (expected , actual )
51395138
5139+ @td .skip_if_no ('py.path' )
51405140 def test_read_from_py_localpath (self ):
51415141
51425142 # GH11773
5143- tm ._skip_if_no_localpath ()
5144-
51455143 from py .path import local as LocalPath
51465144
51475145 expected = DataFrame (np .random .rand (4 , 5 ),
Original file line number Diff line number Diff line change @@ -96,8 +96,10 @@ def _skip_if_not_us_locale():
9696
9797def skip_if_no (package , min_version = None ):
9898 def decorated_func (func ):
99- return pytest .mark .skipif (not safe_import (package , min_version = min_version ),
100- reason = "Could not import '{}'" .format (package ))(func )
99+ return pytest .mark .skipif (
100+ not safe_import (package , min_version = min_version ),
101+ reason = "Could not import '{}'" .format (package )
102+ )(func )
101103 return decorated_func
102104
103105
Original file line number Diff line number Diff line change @@ -359,14 +359,6 @@ def _skip_if_no_xarray():
359359 pytest .skip ("xarray version is too low: {version}" .format (version = v ))
360360
361361
362- def _skip_if_no_localpath ():
363- try :
364- from py .path import local as LocalPath # noqa
365- except ImportError :
366- import pytest
367- pytest .skip ("py.path not installed" )
368-
369-
370362def skip_if_no_ne (engine = 'numexpr' ):
371363 from pandas .core .computation .expressions import (
372364 _USE_NUMEXPR ,
You can’t perform that action at this time.
0 commit comments