mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 23:09:35 +01:00
outputs: validate that output is not ignored (#4386)
This commit is contained in:
@@ -5,6 +5,7 @@ import pytest
|
||||
|
||||
from dvc.exceptions import DvcIgnoreInCollectedDirError
|
||||
from dvc.ignore import DvcIgnore, DvcIgnorePatterns
|
||||
from dvc.output.base import OutputIsIgnoredError
|
||||
from dvc.path_info import PathInfo
|
||||
from dvc.pathspec_math import PatternInfo, merge_patterns
|
||||
from dvc.repo import Repo
|
||||
@@ -400,3 +401,10 @@ def test_ignore_in_added_dir(tmp_dir, dvc):
|
||||
dvc.checkout()
|
||||
|
||||
assert not ignored_path.exists()
|
||||
|
||||
|
||||
def test_ignored_output(tmp_dir, scm, dvc, run_copy):
|
||||
tmp_dir.gen({".dvcignore": "*.log", "foo": "foo content"})
|
||||
|
||||
with pytest.raises(OutputIsIgnoredError):
|
||||
run_copy("foo", "foo.log", name="copy")
|
||||
|
||||
@@ -5,6 +5,7 @@ from funcy import first
|
||||
from voluptuous import MultipleInvalid, Schema
|
||||
|
||||
from dvc.cache import NamedCache
|
||||
from dvc.ignore import _no_match
|
||||
from dvc.output import CHECKSUM_SCHEMA, BaseOutput
|
||||
|
||||
|
||||
@@ -72,6 +73,11 @@ def test_get_used_cache(exists, expected_message, mocker, caplog):
|
||||
stage = mocker.MagicMock()
|
||||
mocker.patch.object(stage, "__str__", return_value="stage: 'stage.dvc'")
|
||||
mocker.patch.object(stage, "addressing", "stage.dvc")
|
||||
mocker.patch.object(
|
||||
stage.repo.tree.dvcignore,
|
||||
"check_ignore",
|
||||
return_value=_no_match("path"),
|
||||
)
|
||||
|
||||
output = BaseOutput(stage, "path")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user