99
1010
1111@pytest .mark .skipif (
12- sys .platform .startswith ("win" ),
13- reason = "don't run test on Windows" ,
12+ sys .platform .startswith ("win" ), reason = "don't run test on Windows" ,
1413)
1514def test_posix_path (local_testdir ):
1615 assert isinstance (UPath (local_testdir ), pathlib .PosixPath )
@@ -89,8 +88,7 @@ def test_new_method(local_testdir):
8988
9089
9190@pytest .mark .skipif (
92- sys .platform .startswith ("win" ),
93- reason = "don't run test on Windows" ,
91+ sys .platform .startswith ("win" ), reason = "don't run test on Windows" ,
9492) # need to fix windows tests here
9593class TestFSSpecLocal (BaseTests ):
9694 @pytest .fixture (autouse = True )
@@ -99,14 +97,23 @@ def path(self, local_testdir):
9997 self .path = UPath (path )
10098
10199
102- PATHS = ["/tmp/abc" , "s3://bucket/folder" , "gs://bucket/folder" ]
100+ PATHS = {
101+ "/tmp/abc" : None ,
102+ "s3://bucket/folder" : "s3fs" ,
103+ "gs://bucket/folder" : "gcsfs" ,
104+ }
103105
104106
105- @pytest .mark .parametrize ("path" , PATHS )
106- def test_create_from_type (path ):
107+ @pytest .mark .parametrize (("path" , "module" ), PATHS .items ())
108+ def test_create_from_type (path , module ):
109+ if module :
110+ pytest .importorskip (module )
107111 parts = path .split ("/" )
108112 parent = "/" .join (parts [:- 1 ])
109- upath = UPath (path )
110- cast = type (upath )
111- new = cast (parent )
112- assert isinstance (new , cast )
113+ try :
114+ upath = UPath (path )
115+ cast = type (upath )
116+ new = cast (parent )
117+ assert isinstance (new , cast )
118+ except (ImportError , ModuleNotFoundError ):
119+ pass
0 commit comments