Skip to content

Commit 6fcfd3b

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

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tests/test_filesystem.py

Lines changed: 12 additions & 9 deletions
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,7 @@ 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", [(S3_URI, None), (AZ_URI, None), (AZ_DSN_URI, None), (GCS_URI, None)], indirect=["fs"]
344343
)
345344
def test_io_write_file(fs, patchs, monkeypatch):
346345
_, path_to, read, _, _, _, _ = fs
@@ -471,7 +470,7 @@ def test_dataset_from_remote_filename(fs, patchs, monkeypatch):
471470

472471

473472
@pytest.mark.parametrize(
474-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
473+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
475474
)
476475
def test_gfile_GFile_writable(fs, patchs, monkeypatch):
477476
uri, path_to, read, _, _, _, _ = fs
@@ -500,7 +499,7 @@ def test_gfile_GFile_writable(fs, patchs, monkeypatch):
500499

501500

502501
@pytest.mark.parametrize(
503-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
502+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
504503
)
505504
def test_gfile_isdir(fs, patchs, monkeypatch):
506505
_, path_to, _, write, mkdirs, join, _ = fs
@@ -518,10 +517,10 @@ def test_gfile_isdir(fs, patchs, monkeypatch):
518517

519518

520519
@pytest.mark.parametrize(
521-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
520+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
522521
)
523522
def test_gfile_listdir(fs, patchs, monkeypatch):
524-
_, path_to, _, write, mkdirs, join, _ = fs
523+
uri, path_to, _, write, mkdirs, join, _ = fs
525524
mock_patchs(monkeypatch, patchs)
526525

527526
root_path = "test_gfile_listdir"
@@ -531,6 +530,10 @@ def test_gfile_listdir(fs, patchs, monkeypatch):
531530
num_childs = 5
532531
childrens = [None] * num_childs
533532
childrens[0] = join(dname, "subdir")
533+
# TODO(vnvo2409): `gs` filesystem requires `/` at the end of directory's path.
534+
# Consider if we could change the behavior for matching the other filesystems.
535+
if uri == GCS_URI:
536+
childrens[0] += "/"
534537
mkdirs(childrens[0])
535538

536539
body = b"123456789"
@@ -544,7 +547,7 @@ def test_gfile_listdir(fs, patchs, monkeypatch):
544547

545548

546549
@pytest.mark.parametrize(
547-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
550+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
548551
)
549552
def test_gfile_makedirs(fs, patchs, monkeypatch):
550553
_, path_to, _, write, _, join, _ = fs
@@ -581,7 +584,7 @@ def test_gfile_remove(fs, patchs, monkeypatch):
581584

582585

583586
@pytest.mark.parametrize(
584-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
587+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
585588
)
586589
def test_gfile_rmtree(fs, patchs, monkeypatch):
587590
_, path_to, _, write, mkdirs, join, _ = fs
@@ -658,7 +661,7 @@ def test_gfile_rename(fs, patchs, monkeypatch):
658661

659662

660663
@pytest.mark.parametrize(
661-
"fs, patchs", [(S3_URI, None), (AZ_URI, None)], indirect=["fs"]
664+
"fs, patchs", [(S3_URI, None), (AZ_URI, None), (GCS_URI, None)], indirect=["fs"]
662665
)
663666
def test_gfile_glob(fs, patchs, monkeypatch):
664667
_, path_to, _, write, _, join, _ = fs

0 commit comments

Comments
 (0)