Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant committed Mar 8, 2024
1 parent f3d23d7 commit 6abfa72
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions gcsfs/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,27 @@
TEST_REQUESTER_PAYS_BUCKET = gcsfs.tests.settings.TEST_REQUESTER_PAYS_BUCKET


def test_simple(gcs):
assert not GoogleCredentials.tokens
def test_simple(gcs, monkeypatch):
monkeypatch.setattr(GoogleCredentials, "tokens", None)
gcs.ls(TEST_BUCKET) # no error
gcs.ls("/" + TEST_BUCKET) # OK to lead with '/'


def test_dircache_filled(gcs, mocker):
assert not dict(gcs.dircache)
gcs.ls(TEST_BUCKET)
assert len(gcs.dircache) == 1
gcs.dircache[TEST_BUCKET][0]["CHECK"] = True
out = gcs.ls(TEST_BUCKET, detail=True)
assert [o for o in out if o.get("CHECK", None)]

gcs.invalidate_cache()
assert not dict(gcs.dircache)

gcs.find(TEST_BUCKET)
assert len(gcs.dircache)


def test_many_connect(docker_gcs):
from multiprocessing.pool import ThreadPool

Expand Down

0 comments on commit 6abfa72

Please sign in to comment.