mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
dvc: properly build DAG for dependency directories
Fixes #1338 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+2
-1
@@ -1058,7 +1058,8 @@ class Project(object):
|
||||
for dep in stage.deps:
|
||||
for out in outs:
|
||||
if out.path != dep.path \
|
||||
and not dep.path.startswith(out.path + out.sep):
|
||||
and not dep.path.startswith(out.path + out.sep) \
|
||||
and not out.path.startswith(dep.path + dep.sep):
|
||||
continue
|
||||
|
||||
dep_stage = out.stage
|
||||
|
||||
@@ -79,6 +79,47 @@ class TestReproDepUnderDir(TestDvc):
|
||||
self.assertTrue(filecmp.cmp(self.file1, self.FOO, shallow=False))
|
||||
|
||||
|
||||
class TestReproDepDirWithOutputsUnderIt(TestDvc):
|
||||
def test(self):
|
||||
stages = self.dvc.add(self.DATA)
|
||||
self.assertEqual(len(stages), 1)
|
||||
self.assertTrue(stages[0] is not None)
|
||||
|
||||
sleep()
|
||||
|
||||
stages = self.dvc.add(self.DATA_SUB)
|
||||
self.assertEqual(len(stages), 1)
|
||||
self.assertTrue(stages[0] is not None)
|
||||
|
||||
sleep()
|
||||
|
||||
stage = self.dvc.run(fname='Dvcfile',
|
||||
deps=[self.DATA, self.DATA_SUB])
|
||||
self.assertTrue(stage is not None)
|
||||
|
||||
sleep()
|
||||
|
||||
file1 = 'file1'
|
||||
file1_stage = file1 + '.dvc'
|
||||
stage = self.dvc.run(fname=file1_stage,
|
||||
deps=[self.DATA_DIR],
|
||||
outs=[file1],
|
||||
cmd='python {} {} {}'.format(self.CODE,
|
||||
self.DATA,
|
||||
file1))
|
||||
self.assertTrue(stage is not None)
|
||||
|
||||
sleep()
|
||||
|
||||
os.unlink(self.DATA)
|
||||
shutil.copyfile(self.FOO, self.DATA)
|
||||
|
||||
sleep()
|
||||
|
||||
stages = self.dvc.reproduce(file1_stage)
|
||||
self.assertEqual(len(stages), 2)
|
||||
|
||||
|
||||
class TestReproNoDeps(TestRepro):
|
||||
def test(self):
|
||||
out = 'out'
|
||||
|
||||
Reference in New Issue
Block a user