mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-07 23:09:21 +01:00
1) split Project's methods into separate files; 2) rename Project into Repo(similar to gitpython's Repo) Signed-off-by: Ruslan Kuprieiev <[email protected]>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import mock
|
|
from unittest import TestCase
|
|
|
|
from dvc.remote import REMOTES, RemoteLOCAL, RemoteSSH, RemoteHDFS
|
|
from dvc.remote.base import RemoteBase, RemoteCmdError, RemoteMissingDepsError
|
|
|
|
|
|
class TestMissingDeps(TestCase):
|
|
def test(self):
|
|
remotes = REMOTES + [RemoteLOCAL, RemoteBase]
|
|
for remote_class in remotes:
|
|
REQUIRES = {"foo": None, "bar": None, "mock": mock}
|
|
with mock.patch.object(remote_class, "REQUIRES", REQUIRES):
|
|
with self.assertRaises(RemoteMissingDepsError):
|
|
remote_class(None, {})
|
|
|
|
|
|
class TestCmdError(TestCase):
|
|
def test(self):
|
|
for remote_class in [RemoteSSH, RemoteHDFS]:
|
|
repo = None
|
|
config = {}
|
|
|
|
remote_name = remote_class.scheme
|
|
cmd = "sed 'hello'"
|
|
ret = "1"
|
|
err = "sed: expression #1, char 2: extra characters after command"
|
|
|
|
with mock.patch.object(
|
|
remote_class,
|
|
"remove",
|
|
side_effect=RemoteCmdError(remote_name, cmd, ret, err),
|
|
):
|
|
with self.assertRaises(RemoteCmdError):
|
|
remote_class(repo, config).remove("file")
|