Skip to content

Commit 6fe13a1

Browse files
authored
Minor fixes for tests (#312)
* tests: cleanup azure tests * tests: fix error with s3 fixture with global moto install * tests: support gcs tests without internet connection Specify token storage argument to avoid timeouts due to credential refresh without internet connectivity.
1 parent 635fa20 commit 6fe13a1

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

upath/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def s3_server():
141141
port = 5555
142142
endpoint_uri = f"http://127.0.0.1:{port}/"
143143
proc = subprocess.Popen(
144-
shlex.split(f"moto_server -p {port}"),
144+
[sys.executable, *shlex.split(f"-m moto.server -p {port}")],
145145
stderr=subprocess.DEVNULL,
146146
stdout=subprocess.DEVNULL,
147147
)
@@ -231,7 +231,7 @@ def docker_gcs():
231231
@pytest.fixture
232232
def gcs_fixture(docker_gcs, local_testdir):
233233
pytest.importorskip("gcsfs")
234-
gcs = fsspec.filesystem("gcs", endpoint_url=docker_gcs)
234+
gcs = fsspec.filesystem("gcs", endpoint_url=docker_gcs, token="anon")
235235
bucket_name = "test_bucket"
236236
if gcs.exists(bucket_name):
237237
for dir, _, keys in gcs.walk(bucket_name):

upath/tests/implementations/test_azure.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ def test_rmdir(self):
3838
with pytest.raises(NotADirectoryError):
3939
(self.path / "a" / "file.txt").rmdir()
4040

41-
@pytest.mark.skip
42-
def test_makedirs_exist_ok_false(self):
43-
pass
44-
45-
def test_rglob(self, pathlib_base):
46-
return super().test_rglob(pathlib_base)
47-
4841
def test_protocol(self):
4942
# test all valid protocols for azure...
5043
protocol = self.path.protocol

upath/tests/implementations/test_gcs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class TestGCSPath(BaseTests):
1616
@pytest.fixture(autouse=True, scope="function")
1717
def path(self, gcs_fixture):
1818
path, endpoint_url = gcs_fixture
19-
self.path = UPath(path, endpoint_url=endpoint_url)
20-
self.endpoint_url = endpoint_url
19+
self.path = UPath(path, endpoint_url=endpoint_url, token="anon")
2120

2221
def test_is_GCSPath(self):
2322
assert isinstance(self.path, GCSPath)
@@ -39,7 +38,7 @@ def test_makedirs_exist_ok_false(self):
3938

4039
@skip_on_windows
4140
def test_mkdir_in_empty_bucket(docker_gcs):
42-
fs = fsspec.filesystem("gcs", endpoint_url=docker_gcs)
41+
fs = fsspec.filesystem("gcs", endpoint_url=docker_gcs, token="anon")
4342
fs.mkdir("my-fresh-bucket")
4443
assert "my-fresh-bucket/" in fs.buckets
4544
fs.invalidate_cache()
@@ -48,4 +47,5 @@ def test_mkdir_in_empty_bucket(docker_gcs):
4847
UPath(
4948
"gs://my-fresh-bucket/some-dir/another-dir/file",
5049
endpoint_url=docker_gcs,
50+
token="anon",
5151
).parent.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)