diff --git a/tests/test_data_cloud.py b/tests/test_data_cloud.py index ae7e33dcd..5bd914b5a 100644 --- a/tests/test_data_cloud.py +++ b/tests/test_data_cloud.py @@ -65,7 +65,23 @@ def _should_test_gcp(): if not os.path.exists(TestDvc.GCP_CREDS_FILE): return False - if os.getenv("GCP_CREDS"): + creds = os.getenv("GOOGLE_APPLICATION_CREDENTIALS") + if creds and os.getenv("GCP_CREDS"): + if os.path.exists(creds): + os.unlink(creds) + shutil.copyfile(TestDvc.GCP_CREDS_FILE, creds) + try: + check_output( + [ + "gcloud", + "auth", + "activate-service-account", + "--key-file", + creds, + ] + ) + except (CalledProcessError, OSError): + return False return True return False diff --git a/tests/test_repro.py b/tests/test_repro.py index d70a0a3bf..9eee2f4b0 100644 --- a/tests/test_repro.py +++ b/tests/test_repro.py @@ -957,7 +957,7 @@ class TestReproExternalGS(TestReproExternalBase): return "gsutil cp {} {}".format(i, o) def write(self, bucket, key, body): - client = gc.Client.from_service_account_json(self.GCP_CREDS_FILE) + client = gc.Client() bucket = client.bucket(bucket) bucket.blob(key).upload_from_string(body)