Skip to content

Commit d930d13

Browse files
committed
add more tests for gcs filesystem
1 parent f159c78 commit d930d13

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

tests/test_filesystem.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ def mkdirs(_):
226226
yield path_to, read, write, mkdirs, posixpath.join, None
227227

228228

229-
# TODO(vnvo2409): some tests with `gcs` are falling.
230229
@pytest.fixture(scope="module")
231230
def gcs_fs():
232231
if should_skip(GCS_URI):
@@ -340,7 +339,9 @@ def test_io_read_file(fs, patchs, monkeypatch):
340339

341340

342341
@pytest.mark.parametrize(
343-
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (AZ_DSN_URI, None)], indirect=["fs"]
342+
"fs, patchs",
343+
[(S3_URI, None), (AZ_URI, None), (AZ_DSN_URI, None), (GCS_URI, None)],
344+
indirect=["fs"],
344345
)
345346
def test_io_write_file(fs, patchs, monkeypatch):
346347
_, path_to, read, _, _, _, _ = fs
@@ -471,7 +472,7 @@ def test_dataset_from_remote_filename(fs, patchs, monkeypatch):
471472

472473

473474
@pytest.mark.parametrize(
474-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
475+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
475476
)
476477
def test_gfile_GFile_writable(fs, patchs, monkeypatch):
477478
uri, path_to, read, _, _, _, _ = fs
@@ -500,7 +501,7 @@ def test_gfile_GFile_writable(fs, patchs, monkeypatch):
500501

501502

502503
@pytest.mark.parametrize(
503-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
504+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
504505
)
505506
def test_gfile_isdir(fs, patchs, monkeypatch):
506507
_, path_to, _, write, mkdirs, join, _ = fs
@@ -518,10 +519,10 @@ def test_gfile_isdir(fs, patchs, monkeypatch):
518519

519520

520521
@pytest.mark.parametrize(
521-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
522+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
522523
)
523524
def test_gfile_listdir(fs, patchs, monkeypatch):
524-
_, path_to, _, write, mkdirs, join, _ = fs
525+
uri, path_to, _, write, mkdirs, join, _ = fs
525526
mock_patchs(monkeypatch, patchs)
526527

527528
root_path = "test_gfile_listdir"
@@ -531,6 +532,10 @@ def test_gfile_listdir(fs, patchs, monkeypatch):
531532
num_childs = 5
532533
childrens = [None] * num_childs
533534
childrens[0] = join(dname, "subdir")
535+
# TODO(vnvo2409): `gs` filesystem requires `/` at the end of directory's path.
536+
# Consider if we could change the behavior for matching the other filesystems.
537+
if uri == GCS_URI:
538+
childrens[0] += "/"
534539
mkdirs(childrens[0])
535540

536541
body = b"123456789"
@@ -544,7 +549,7 @@ def test_gfile_listdir(fs, patchs, monkeypatch):
544549

545550

546551
@pytest.mark.parametrize(
547-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
552+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
548553
)
549554
def test_gfile_makedirs(fs, patchs, monkeypatch):
550555
_, path_to, _, write, _, join, _ = fs
@@ -581,7 +586,7 @@ def test_gfile_remove(fs, patchs, monkeypatch):
581586

582587

583588
@pytest.mark.parametrize(
584-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
589+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
585590
)
586591
def test_gfile_rmtree(fs, patchs, monkeypatch):
587592
_, path_to, _, write, mkdirs, join, _ = fs
@@ -658,7 +663,7 @@ def test_gfile_rename(fs, patchs, monkeypatch):
658663

659664

660665
@pytest.mark.parametrize(
661-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
666+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
662667
)
663668
def test_gfile_glob(fs, patchs, monkeypatch):
664669
_, path_to, _, write, _, join, _ = fs

0 commit comments

Comments
 (0)