diff --git a/tests/test_repro.py b/tests/test_repro.py index d1305e1c3..b949e7ed4 100644 --- a/tests/test_repro.py +++ b/tests/test_repro.py @@ -27,15 +27,19 @@ class TestRepro(TestDvc): class TestReproChangedCode(TestRepro): def test(self): - repro = 'repro' - with open(self.CODE, 'a') as code: - code.write("\nshutil.copyfile('{}', sys.argv[2])\n".format(self.BAR)) + self.swap_code() stages = self.dvc.reproduce(self.file1_stage) self.assertTrue(filecmp.cmp(self.file1, self.BAR)) self.assertEqual(len(stages), 1) + def swap_code(self): + os.unlink(self.CODE) + new_contents = self.CODE_CONTENTS + new_contents += "\nshutil.copyfile('{}', sys.argv[2])\n".format(self.BAR) + self.create(self.CODE, new_contents) + class TestReproChangedData(TestRepro): def test(self):