Skip to content

Commit 0aaf238

Browse files
committed
fix(tests): mock gcs.Client in GCS backend test to avoid ADC in CI
1 parent 9605a99 commit 0aaf238

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/test_cloud.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ def test_get_backend_s3_returns_s3_backend() -> None:
7676
assert isinstance(backend, S3Backend)
7777

7878

79-
def test_get_backend_gcs_returns_gcs_backend() -> None:
80-
pytest.importorskip("google.cloud.storage")
79+
def test_get_backend_gcs_returns_gcs_backend(monkeypatch: pytest.MonkeyPatch) -> None:
80+
gcs = pytest.importorskip("google.cloud.storage")
81+
from unittest.mock import MagicMock
82+
mock_client = MagicMock()
83+
monkeypatch.setattr(gcs, "Client", lambda: mock_client)
8184
from infermap.cloud.storage import GCSBackend
8285
backend = get_backend("gs://my-bucket/aphex")
8386
assert isinstance(backend, GCSBackend)

0 commit comments

Comments
 (0)