Skip to content

Commit ae11446

Browse files
committed
Try to fix test
1 parent e824a8b commit ae11446

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

pyproject.toml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,18 @@ description-file = "README.md"
2525
dev = []
2626
doc = []
2727
test = [
28-
"requests",
29-
"s3fs",
30-
"jupyter",
31-
"ipython",
32-
"pytest",
33-
"pylint",
28+
"aiohttp",
3429
"flake8",
35-
"pyarrow",
36-
"moto",
30+
"gcsfs",
3731
"hadoop-test-cluster",
32+
"ipython",
33+
"jupyter",
34+
"moto",
35+
"pyarrow",
36+
"pylint",
37+
"pytest",
38+
"requests",
39+
"s3fs",
3840
]
3941

4042
[tool.flit.scripts]

upath/tests/test_core.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
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
)
1514
def 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
9593
class 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

Comments
 (0)