From 7b9ef9ce01d61e01e748f2a064835ff8dc94d9e0 Mon Sep 17 00:00:00 2001 From: Amy Wang Date: Mon, 4 Nov 2024 12:12:35 -0500 Subject: [PATCH] Handle cache_timeout = 0 in GCSFileSystem (#646) * add is not none * test --- gcsfs/core.py | 2 +- gcsfs/tests/test_core.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gcsfs/core.py b/gcsfs/core.py index 6fd05eae..73dbcebd 100644 --- a/gcsfs/core.py +++ b/gcsfs/core.py @@ -285,7 +285,7 @@ def __init__( version_aware=False, **kwargs, ): - if cache_timeout: + if cache_timeout is not None: kwargs["listings_expiry_time"] = cache_timeout super().__init__( self, diff --git a/gcsfs/tests/test_core.py b/gcsfs/tests/test_core.py index 28f1a1d6..2a0b4c0c 100644 --- a/gcsfs/tests/test_core.py +++ b/gcsfs/tests/test_core.py @@ -1428,6 +1428,8 @@ def test_expiry_keyword(): assert gcs.dircache.listings_expiry_time == 1 gcs = GCSFileSystem(cache_timeout=1, token="anon") assert gcs.dircache.listings_expiry_time == 1 + gcs = GCSFileSystem(cache_timeout=0, token="anon") + assert gcs.dircache.listings_expiry_time == 0 def test_copy_cache_invalidated(gcs):