repro: Fix --all-pipelines option

Fix #1435
This commit is contained in:
Mr. Outis
2018-12-16 18:31:40 -06:00
parent 286373f9c7
commit e8a081030f
2 changed files with 31 additions and 0 deletions
+4
View File
@@ -12,6 +12,10 @@ class CmdRepro(CmdBase):
if self.args.cwd:
os.chdir(self.args.cwd)
# Dirty hack so the for loop below can at least enter once
if self.args.all_pipelines:
self.args.targets = [None]
ret = 0
for target in self.args.targets:
try:
+27
View File
@@ -28,6 +28,7 @@ from tests.test_data_cloud import _should_test_gcp, TEST_GCP_REPO_BUCKET
from tests.test_data_cloud import _should_test_ssh, _should_test_hdfs
from tests.test_data_cloud import sleep
from tests.utils.httpd import StaticFileServer
from mock import patch
class TestRepro(TestDvc):
@@ -1027,3 +1028,29 @@ class TestReproNoSCM(TestRepro):
shutil.rmtree(self.dvc.scm.dir)
ret = main(['repro', self.file1_stage])
self.assertEqual(ret, 0)
class TestReproAllPipelines(TestDvc):
def test(self):
self.dvc.run(fname='start.dvc',
outs=['start.txt'],
cmd='echo start > start.txt')
self.dvc.run(fname='middle.dvc',
deps=['start.txt'],
outs=['middle.txt'],
cmd='echo middle > middle.txt')
self.dvc.run(fname='final.dvc',
deps=['middle.txt'],
outs=['final.txt'],
cmd='echo final > final.txt')
self.dvc.run(fname='disconnected.dvc',
outs=['disconnected.txt'],
cmd='echo other > disconnected.txt')
with patch.object(Stage, 'reproduce') as mock_reproduce:
ret = main(['repro', '--all-pipelines'])
self.assertEqual(ret, 0)
self.assertEqual(mock_reproduce.call_count, 4)