mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
25 lines
657 B
Python
25 lines
657 B
Python
import os
|
|
|
|
from dvc.lock import Lock
|
|
from dvc.lock import LockError
|
|
from dvc.main import main
|
|
from tests.basic_env import TestDvc
|
|
|
|
|
|
class TestLock(TestDvc):
|
|
def test_with(self):
|
|
lockfile = os.path.join(self.dvc.dvc_dir, "lock")
|
|
lock = Lock(lockfile)
|
|
with lock:
|
|
with self.assertRaises(LockError):
|
|
lock2 = Lock(lockfile)
|
|
with lock2:
|
|
self.assertTrue(False)
|
|
|
|
def test_cli(self):
|
|
lockfile = os.path.join(self.dvc.dvc_dir, "lock")
|
|
lock = Lock(lockfile)
|
|
with lock:
|
|
ret = main(["add", self.FOO])
|
|
self.assertEqual(ret, 1)
|