diff --git a/tests/system/data/setup_fixtures.py b/tests/system/data/setup_fixtures.py index 7a7faa5f5..5f709f6b8 100644 --- a/tests/system/data/setup_fixtures.py +++ b/tests/system/data/setup_fixtures.py @@ -35,8 +35,15 @@ def event_loop(): def instance_admin_client(): """Client for interacting with the Instance Admin API.""" from google.cloud.bigtable_admin_v2 import BigtableInstanceAdminClient + from google.cloud.environment_vars import BIGTABLE_EMULATOR # type: ignore + import google.auth.credentials - with BigtableInstanceAdminClient() as client: + # check for emulator mode + credentials = None + if os.getenv(BIGTABLE_EMULATOR) is not None: + credentials = google.auth.credentials.AnonymousCredentials() + + with BigtableInstanceAdminClient(credentials=credentials) as client: yield client @@ -44,8 +51,15 @@ def instance_admin_client(): def table_admin_client(): """Client for interacting with the Table Admin API.""" from google.cloud.bigtable_admin_v2 import BigtableTableAdminClient + from google.cloud.environment_vars import BIGTABLE_EMULATOR + import google.auth.credentials + + # check for emulator mode + credentials = None + if os.getenv(BIGTABLE_EMULATOR) is not None: + credentials = google.auth.credentials.AnonymousCredentials() - with BigtableTableAdminClient() as client: + with BigtableTableAdminClient(credentials=credentials) as client: yield client