diff --git a/tests/func/test_data_cloud.py b/tests/func/test_data_cloud.py index 9ee5599b71..dd2b701544 100644 --- a/tests/func/test_data_cloud.py +++ b/tests/func/test_data_cloud.py @@ -34,10 +34,10 @@ _should_test_aws, _should_test_azure, _should_test_gcp, - _should_test_gdrive, _should_test_hdfs, _should_test_oss, _should_test_ssh, + GDrive, TEST_CONFIG, TEST_SECTION, TEST_GCP_CREDS_FILE, @@ -47,7 +47,6 @@ get_aws_url, get_azure_url, get_gcp_url, - get_gdrive_url, get_hdfs_url, get_local_url, get_oss_url, @@ -209,7 +208,7 @@ def _get_cloud_class(self): class TestRemoteGDrive(TestDataCloudBase): def _should_test(self): - return _should_test_gdrive() + return GDrive.should_test() def _setup_cloud(self): self._ensure_should_run() @@ -230,7 +229,7 @@ def _setup_cloud(self): self.assertIsInstance(self.cloud.get_remote(), self._get_cloud_class()) def _get_url(self): - return get_gdrive_url() + return GDrive.get_url() def _get_cloud_class(self): return RemoteGDrive @@ -484,10 +483,10 @@ def _test(self): class TestRemoteGDriveCLI(TestDataCloudCLIBase): def _should_test(self): - return _should_test_gdrive() + return GDrive.should_test() def _test(self): - url = get_gdrive_url() + url = GDrive.get_url() self.main(["remote", "add", TEST_REMOTE, url]) self.main( diff --git a/tests/remotes.py b/tests/remotes.py index 8c03955e6b..5923439228 100644 --- a/tests/remotes.py +++ b/tests/remotes.py @@ -54,13 +54,6 @@ def _should_test_aws(): return False -def _should_test_gdrive(): - if os.getenv(RemoteGDrive.GDRIVE_USER_CREDENTIALS_DATA): - return True - - return False - - def _should_test_gcp(): do_test = env2bool("DVC_TEST_GCP", undefined=None) if do_test is not None: @@ -193,10 +186,6 @@ def get_aws_url(): return "s3://" + get_aws_storagepath() -def get_gdrive_url(): - return "gdrive://root/" + str(uuid.uuid4()) - - def get_gcp_storagepath(): return TEST_GCP_REPO_BUCKET + "/" + str(uuid.uuid4()) @@ -268,6 +257,16 @@ def put_objects(remote, objects): bucket.blob((remote.path_info / key).path).upload_from_string(body) +class GDrive: + @staticmethod + def should_test(): + return os.getenv(RemoteGDrive.GDRIVE_USER_CREDENTIALS_DATA) is not None + + @staticmethod + def get_url(): + return "gdrive://root/" + str(uuid.uuid4()) + + class Azure: should_test = staticmethod(_should_test_azure) get_url = staticmethod(get_azure_url)