Merge pull request #1436 from mroutis/fix-1435

repro: Fix --all-pipelines option
This commit is contained in:
Ruslan Kuprieiev
2018-12-18 18:35:37 +02:00
committed by GitHub
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
@@ -27,6 +27,7 @@ from tests.test_data_cloud import _should_test_aws, TEST_AWS_REPO_BUCKET
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.utils.httpd import StaticFileServer
from mock import patch
class TestRepro(TestDvc):
@@ -995,3 +996,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)