mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
run: Add abspath to circular dependency check and include outs_no_cache (#1272)
Close #1235
This commit is contained in:
+5
-2
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user