mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-11 07:18:28 +01:00
get: test get_url raises exception if not a dvc repo
This commit is contained in:
+10
-1
@@ -6,7 +6,7 @@ import ruamel.yaml
|
||||
import pytest
|
||||
|
||||
from dvc import api
|
||||
from dvc.api import SummonError
|
||||
from dvc.api import SummonError, UrlNotDvcRepoError
|
||||
from dvc.compat import fspath
|
||||
from dvc.exceptions import FileMissingError
|
||||
from dvc.main import main
|
||||
@@ -51,6 +51,15 @@ def test_get_url_external(erepo_dir, remote_url):
|
||||
assert api.get_url("foo", repo=repo_url) == expected_url
|
||||
|
||||
|
||||
def test_get_url_git_only_repo_throws_exception(tmp_dir, scm):
|
||||
tmp_dir.scm_gen({"foo": "foo"}, commit="initial")
|
||||
|
||||
with pytest.raises(UrlNotDvcRepoError) as exc_info:
|
||||
api.get_url("foo", fspath(tmp_dir))
|
||||
|
||||
assert fspath(tmp_dir) in str(exc_info)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("remote_url", all_remote_params, indirect=True)
|
||||
def test_open(remote_url, tmp_dir, dvc):
|
||||
run_dvc("remote", "add", "-d", "upstream", remote_url)
|
||||
|
||||
Reference in New Issue
Block a user