run: Add abspath to circular dependency check and include outs_no_cache (#1272)

Close #1235
This commit is contained in:
Mr. Outis
2018-10-29 11:44:48 -06:00
committed by GitHub
parent 7ae97009fa
commit c4295fa05c
2 changed files with 20 additions and 2 deletions
+5 -2
View File
@@ -146,7 +146,10 @@ class Project(object):
def _check_circular_dependency(self, deps, outs):
from dvc.exceptions import CircularDependencyError
circular_dependencies = set(deps) & set(outs)
circular_dependencies = (
set(file.path for file in deps) &
set(file.path for file in outs)
)
if circular_dependencies:
raise CircularDependencyError(circular_dependencies.pop())
@@ -298,7 +301,7 @@ class Project(object):
overwrite=overwrite)
self._check_output_duplication(stage.outs)
self._check_circular_dependency(deps, outs)
self._check_circular_dependency(stage.deps, stage.outs)
self._files_to_git_add = []
with self.state:
+15
View File
@@ -102,6 +102,21 @@ class TestRunCircularDependency(TestDvc):
outs=[self.FOO],
fname='circular-dependency.dvc')
def test_outs_no_cache(self):
with self.assertRaises(CircularDependencyError):
self.dvc.run(cmd='',
deps=[self.FOO],
outs_no_cache=[self.FOO],
fname='circular-dependency.dvc')
def test_non_normalized_paths(self):
with self.assertRaises(CircularDependencyError):
self.dvc.run(cmd='',
deps=['./foo'],
outs=['foo'],
fname='circular-dependency.dvc')
class TestRunBadCwd(TestDvc):
def test(self):
with self.assertRaises(StageBadCwdError):