Files
dvc/tests/test_install.py
T
Andrew Grigorev 8c8b585de9 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.
2019-03-21 19:47:42 +03:00

29 lines
725 B
Python

import os
from dvc.main import main
from tests.basic_env import TestDvc
class TestInstall(TestDvc):
def test(self):
ret = main(["install"])
self.assertEqual(ret, 0)
ret = main(["install"])
self.assertNotEqual(ret, 0)
def hook(name):
return os.path.join(".git", "hooks", name)
self.assertTrue(os.path.isfile(hook("post-checkout")))
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)
self.assertTrue(os.path.isfile(self.FOO))