mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
test: move func tests to tests/func
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
6c730dd5cb
commit
6f11f1f51f
@@ -0,0 +1,66 @@
|
||||
import os
|
||||
|
||||
from dvc.main import main
|
||||
from dvc.repo import Repo as DvcRepo
|
||||
from dvc.exceptions import InitError
|
||||
|
||||
from tests.basic_env import TestGit, TestDir
|
||||
|
||||
|
||||
class TestInit(TestGit):
|
||||
def _test_init(self):
|
||||
self.assertTrue(os.path.exists(DvcRepo.DVC_DIR))
|
||||
self.assertTrue(os.path.isdir(DvcRepo.DVC_DIR))
|
||||
|
||||
def test_api(self):
|
||||
DvcRepo.init()
|
||||
|
||||
self._test_init()
|
||||
|
||||
def test_cli(self):
|
||||
ret = main(["init"])
|
||||
self.assertEqual(ret, 0)
|
||||
|
||||
self._test_init()
|
||||
|
||||
|
||||
class TestDoubleInit(TestInit):
|
||||
def test(self):
|
||||
ret = main(["init"])
|
||||
self.assertEqual(ret, 0)
|
||||
self._test_init()
|
||||
|
||||
ret = main(["init"])
|
||||
self.assertNotEqual(ret, 0)
|
||||
self._test_init()
|
||||
|
||||
ret = main(["init", "--force"])
|
||||
self.assertEqual(ret, 0)
|
||||
self._test_init()
|
||||
|
||||
|
||||
class TestInitNoSCMFail(TestDir):
|
||||
def test_api(self):
|
||||
with self.assertRaises(InitError):
|
||||
DvcRepo.init()
|
||||
|
||||
def test_cli(self):
|
||||
ret = main(["init"])
|
||||
self.assertNotEqual(ret, 0)
|
||||
|
||||
|
||||
class TestInitNoSCM(TestDir):
|
||||
def _test_init(self):
|
||||
self.assertTrue(os.path.exists(DvcRepo.DVC_DIR))
|
||||
self.assertTrue(os.path.isdir(DvcRepo.DVC_DIR))
|
||||
|
||||
def test_api(self):
|
||||
DvcRepo.init(no_scm=True)
|
||||
|
||||
self._test_init()
|
||||
|
||||
def test_cli(self):
|
||||
ret = main(["init", "--no-scm"])
|
||||
self.assertEqual(ret, 0)
|
||||
|
||||
self._test_init()
|
||||
Reference in New Issue
Block a user