-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Problem
The test tests/transfers/test_contact_with_multiple_wells.py::test_multiple_wells fails when Google Cloud credentials are expired or unavailable locally:
google.auth.exceptions.RefreshError: Reauthentication is needed. Please run `gcloud auth application-default login` to reauthenticate.
The test calls WellTransferer which invokes get_cached_elevations() that accesses Google Cloud Storage.
Suggested Solutions
-
Mock GCS calls in tests - Use
unittest.mockorpytest-mockto mock theget_storage_bucket()and related GCS functions during tests -
Skip tests requiring GCS when credentials unavailable - Add a pytest marker like
@pytest.mark.requires_gcsand skip whenGOOGLE_APPLICATION_CREDENTIALSis not set or invalid -
Use local fixtures - Provide cached elevation data as a test fixture instead of fetching from GCS
Benefits
- Tests can run locally without cloud credentials
- Faster test execution (no network calls)
- More reliable CI/CD (not dependent on credential refresh)
- Better test isolation
Affected Files
tests/transfers/test_contact_with_multiple_wells.pytransfers/well_transfer.py(get_cached_elevations(),WellTransferer)transfers/util.py(download_blob_json())
Metadata
Metadata
Assignees
Labels
No labels