Fail on sync when there is no match for glob.

This commit is contained in:
Karthikeyan Singaravelan
2022-05-11 18:37:09 +03:00
committed by Ruslan Kuprieiev
parent a80a85e6bd
commit e177f041c8
4 changed files with 38 additions and 2 deletions
+20 -1
View File
@@ -9,7 +9,11 @@ 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, PathMissingError
from dvc.exceptions import (
DownloadError,
GlobDoesNotMatchError,
PathMissingError,
)
from dvc.stage.exceptions import StagePathNotFoundError
from dvc.system import System
from dvc.utils.fs import makedirs, remove
@@ -266,6 +270,21 @@ 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
):