From 8d99ce06aa29d7a806063bc8dab310d1e235dc33 Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan Date: Sat, 7 May 2022 00:39:09 +0530 Subject: [PATCH] Move test to test_data_cloud. --- tests/func/test_data_cloud.py | 16 ++++++++++++++++ tests/func/test_import.py | 21 +-------------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/tests/func/test_data_cloud.py b/tests/func/test_data_cloud.py index eea0e549b..629db91f1 100644 --- a/tests/func/test_data_cloud.py +++ b/tests/func/test_data_cloud.py @@ -8,6 +8,7 @@ from flaky.flaky_decorator import flaky import dvc as dvc_module from dvc.cli import main from dvc.data.db.local import LocalObjectDB +from dvc.exceptions import GlobDoesNotMatchError from dvc.external_repo import clean_repos from dvc.objects.db import ObjectDB from dvc.stage.exceptions import StageNotFound @@ -570,3 +571,18 @@ def test_target_remote(tmp_dir, dvc, make_remote): "6b18131dc289fd37006705affe961ef8.dir", "b8a9f715dbb64fd5c56e7783c6820a61", } + + +def test_push_pull_glob_no_match( + tmp_dir, dvc, erepo_dir, run_copy, local_remote +): + tmp_dir.gen("foo", "foo") + erepo_dir.add_remote(config=local_remote.config) + + with erepo_dir.chdir(): + with pytest.raises(GlobDoesNotMatchError): + dvc.push(targets="b*", glob=True) + + with pytest.raises(GlobDoesNotMatchError): + dvc.pull(targets="b*", glob=True) + assert not os.path.exists(erepo_dir.dvc.stage_cache.cache_dir) diff --git a/tests/func/test_import.py b/tests/func/test_import.py index afa46592e..1c9dd986e 100644 --- a/tests/func/test_import.py +++ b/tests/func/test_import.py @@ -9,11 +9,7 @@ from scmrepo.git import Git from dvc.config import NoRemoteError from dvc.data.db import ODBManager from dvc.dvcfile import Dvcfile -from dvc.exceptions import ( - DownloadError, - GlobDoesNotMatchError, - PathMissingError, -) +from dvc.exceptions import DownloadError, PathMissingError from dvc.stage.exceptions import StagePathNotFoundError from dvc.system import System from dvc.utils.fs import makedirs, remove @@ -270,21 +266,6 @@ def test_pull_wildcard_imported_directory_stage(tmp_dir, dvc, erepo_dir): assert (tmp_dir / "dir_imported123").read_text() == {"foo": "foo content"} -def test_push_pull_glob_no_match( - tmp_dir, dvc, erepo_dir, run_copy, local_remote -): - tmp_dir.gen("foo", "foo") - erepo_dir.add_remote(config=local_remote.config) - - with erepo_dir.chdir(): - with pytest.raises(GlobDoesNotMatchError): - dvc.push(targets="b*", glob=True) - - with pytest.raises(GlobDoesNotMatchError): - dvc.pull(targets="b*", glob=True) - assert not os.path.exists(erepo_dir.dvc.stage_cache.cache_dir) - - def test_push_wildcard_from_bare_git_repo( tmp_dir, make_tmp_dir, erepo_dir, local_cloud ):