Skip to content

Commit 40f459e

Browse files
test(bigframes): Disable gcsfs cache for tests (#16995)
1 parent 4bab8c5 commit 40f459e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/bigframes/tests/system/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from datetime import datetime
2323
from typing import Dict, Generator, Optional
2424

25+
import fsspec # type: ignore[import-untyped]
26+
import gcsfs # type: ignore[import-untyped]
2527
import google.api_core.exceptions
2628
import google.cloud.bigquery as bigquery
2729
import google.cloud.bigquery_connection_v1 as bigquery_connection_v1
@@ -70,6 +72,15 @@ def _hash_digest_file(hasher, filepath):
7072
hasher.update(chunk)
7173

7274

75+
@pytest.fixture(scope="session", autouse=True)
76+
def configure_gcsfs():
77+
# gcsfs by default uses a cache that can be stale, causing file loads to
78+
# fail if the file was uploaded indirectly (eg via bq export job) during the
79+
# course of the tests. disable the cache to avoid this.
80+
fsspec.config.conf["gcs"] = {"use_listings_cache": False}
81+
gcsfs.GCSFileSystem.clear_instance_cache()
82+
83+
7384
@pytest.fixture(scope="session")
7485
def tokyo_location() -> str:
7586
return TOKYO_LOCATION

0 commit comments

Comments
 (0)