From e8a081030fad7af950a8516a3ccc07df60c6b111 Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Thu, 13 Dec 2018 14:31:47 -0600 Subject: [PATCH] repro: Fix --all-pipelines option Fix #1435 --- dvc/command/repro.py | 4 ++++ tests/test_repro.py | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/dvc/command/repro.py b/dvc/command/repro.py index 726cbfeed..d51254833 100644 --- a/dvc/command/repro.py +++ b/dvc/command/repro.py @@ -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: diff --git a/tests/test_repro.py b/tests/test_repro.py index 1233b9903..aca6f7d70 100644 --- a/tests/test_repro.py +++ b/tests/test_repro.py @@ -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)