mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 15:28:27 +01:00
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
from unittest import TestCase
|
|
|
|
import mock
|
|
|
|
from dvc.remote.base import RemoteBASE
|
|
from dvc.remote.base import RemoteCmdError
|
|
from dvc.remote.base import RemoteMissingDepsError
|
|
|
|
|
|
class TestRemoteBASE(object):
|
|
REMOTE_CLS = RemoteBASE
|
|
|
|
|
|
class TestMissingDeps(TestCase, TestRemoteBASE):
|
|
def test(self):
|
|
requires = {"missing": "missing"}
|
|
with mock.patch.object(self.REMOTE_CLS, "REQUIRES", requires):
|
|
with self.assertRaises(RemoteMissingDepsError):
|
|
self.REMOTE_CLS(None, {})
|
|
|
|
|
|
class TestCmdError(TestCase, TestRemoteBASE):
|
|
def test(self):
|
|
repo = None
|
|
config = {}
|
|
|
|
cmd = "sed 'hello'"
|
|
ret = "1"
|
|
err = "sed: expression #1, char 2: extra characters after command"
|
|
|
|
with mock.patch.object(
|
|
self.REMOTE_CLS,
|
|
"remove",
|
|
side_effect=RemoteCmdError("base", cmd, ret, err),
|
|
):
|
|
with self.assertRaises(RemoteCmdError):
|
|
self.REMOTE_CLS(repo, config).remove("file")
|