Skip to content

Commit 6a1f979

Browse files
committed
test(mock): fix GCP client test by delaying import after patch
1 parent 9d779f1 commit 6a1f979

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/test_gcp_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import pytest
21
from unittest.mock import patch, MagicMock
3-
from clients.gcp_client import list_gcs_objects
42

53
@patch("clients.gcp_client.storage.Client")
64
def test_list_gcs_objects(mock_client_class):
@@ -18,7 +16,10 @@ def test_list_gcs_objects(mock_client_class):
1816
mock_client.get_bucket.return_value = mock_bucket
1917
mock_client_class.return_value = mock_client
2018

19+
# ✅ Import AFTER patch is active
20+
from clients.gcp_client import list_gcs_objects
2121
objects = list_gcs_objects("demo-gcp")
22+
2223
assert isinstance(objects, list)
2324
assert "demo-blob.json" in objects
2425
assert "config.yaml" in objects

0 commit comments

Comments
 (0)