mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user