Merge pull request #1650 from mroutis/fix-1634

stage: always reproduce callback stages
This commit is contained in:
Ruslan Kuprieiev
2019-02-22 13:01:11 +02:00
committed by GitHub
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -657,7 +657,7 @@ class Stage(object):
else:
logger.info("Running command:\n\t{}".format(self.cmd))
if not dry:
if self._already_cached():
if not self.is_callback and self._already_cached():
self.checkout()
else:
self._run()
+16
View File
@@ -1277,3 +1277,19 @@ class TestReproNoCommit(TestRepro):
ret = main(["repro", self.file1_stage, "--no-commit"])
self.assertEqual(ret, 0)
self.assertEqual(len(os.listdir(self.dvc.cache.local.cache_dir)), 0)
class TestReproAlreadyCached(TestRepro):
def test(self):
first_out = self.dvc.run(
fname="random.dvc",
deps=[],
outs=["random.txt"],
cmd='python -c "{}" > random.txt'.format(
"from random import random; print(random())"
),
).outs[0]
second_out = self.dvc.reproduce(target="random.dvc")[0].outs[0]
self.assertNotEqual(first_out.checksum, second_out.checksum)