mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 07:18:25 +01:00
tests: test unsupported remote
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
@@ -11,3 +11,9 @@ class DvcException(Exception):
|
||||
except Exception:
|
||||
pass
|
||||
super(DvcException, self).__init__(msg)
|
||||
|
||||
|
||||
class UnsupportedRemoteError(DvcException):
|
||||
def __init__(self, config, cause=None):
|
||||
msg = "Remote '{}' is not supported.".format(config)
|
||||
super(UnsupportedRemoteError, self).__init__(msg, cause=cause)
|
||||
|
||||
@@ -6,7 +6,7 @@ from dvc.remote.ssh import RemoteSSH
|
||||
from dvc.remote.azure import RemoteAzure
|
||||
|
||||
from dvc.config import Config
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.exceptions import UnsupportedRemoteError
|
||||
|
||||
|
||||
REMOTES = [RemoteHDFS, RemoteSSH, RemoteS3, RemoteGS, RemoteAzure, RemoteLOCAL]
|
||||
@@ -24,4 +24,4 @@ def Remote(project, config):
|
||||
for r in REMOTES:
|
||||
if r.supported(config):
|
||||
return r(project, config)
|
||||
raise DvcException('Remote \'{}\' is not supported.'.format(config))
|
||||
raise UnsupportedRemoteError(str(config))
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from dvc.main import main
|
||||
from dvc.command.remote import CmdRemoteAdd
|
||||
from dvc.exceptions import UnsupportedRemoteError
|
||||
from dvc.remote import Remote
|
||||
from dvc.config import Config
|
||||
|
||||
from tests.basic_env import TestDvc
|
||||
|
||||
@@ -34,3 +37,7 @@ class TestRemote(TestDvc):
|
||||
cmd.configobj.write = None
|
||||
ret = cmd.run()
|
||||
self.assertNotEqual(ret, 0)
|
||||
|
||||
def test_unsupported(self):
|
||||
with self.assertRaises(UnsupportedRemoteError):
|
||||
Remote(self.dvc, {Config.SECTION_REMOTE_URL: 'unsupported://url')
|
||||
|
||||
Reference in New Issue
Block a user