tests: test_install commit and clean

Uncommited files wouldn't be accessible as git objects.

It needs `git clean -fd` to amend "Working Tree" metrics collection
which took its part when the git tree is dirty.
This commit is contained in:
Andrew Grigorev
2019-03-21 19:47:42 +03:00
parent 9e6c52079b
commit 8c8b585de9
2 changed files with 7 additions and 1 deletions
+2
View File
@@ -20,6 +20,8 @@ class TestInstall(TestDvc):
self.assertTrue(os.path.isfile(hook("pre-commit")))
self.dvc.add(self.FOO)
self.dvc.scm.add([".gitignore", self.FOO + ".dvc"])
self.dvc.scm.commit("add")
os.unlink(self.FOO)
self.dvc.scm.checkout("branch", create_new=True)
+5 -1
View File
@@ -489,7 +489,7 @@ class TestCachedMetrics(TestDvc):
self.assertIsNotNone(stage)
self.assertEqual(stage.relpath, "metrics.json.dvc")
self.dvc.scm.add([".gitignore", "metrics.json.dvc"])
self.dvc.scm.add(["code.py", ".gitignore", "metrics.json.dvc"])
self.dvc.scm.commit(branch)
def _test_metrics(self, func):
@@ -502,6 +502,10 @@ class TestCachedMetrics(TestDvc):
func("one")
func("two")
# TestDvc currently is based on TestGit, so it is safe to use
# scm.git for now
self.dvc.scm.git.git.clean("-fd")
self.dvc = DvcRepo(".")
res = self.dvc.metrics.show(