mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-18 23:10:14 +01:00
fixed test case
This commit is contained in:
@@ -74,12 +74,14 @@ def _external_repo(url=None, rev=None, cache_dir=None):
|
||||
if os.path.isdir(url):
|
||||
rconfig = RemoteConfig(repo.config)
|
||||
if not _remote_config_exists(rconfig):
|
||||
original_repo = Repo(url)
|
||||
rconfig.add(
|
||||
"upstream",
|
||||
repo.cache.local.cache_dir,
|
||||
original_repo.cache.local.cache_dir,
|
||||
default=True,
|
||||
level=Config.LEVEL_LOCAL,
|
||||
)
|
||||
original_repo.close()
|
||||
|
||||
if cache_dir is not None:
|
||||
cache_config = CacheConfig(repo.config)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import filecmp
|
||||
import os
|
||||
|
||||
from mock import patch
|
||||
@@ -30,8 +31,10 @@ def test_external_repo(erepo):
|
||||
|
||||
|
||||
def test_external_repo_import_without_remote(erepo, dvc_repo):
|
||||
src = erepo.CODE
|
||||
dst = dvc_repo.root_dir
|
||||
src = erepo.FOO
|
||||
dst = os.path.join(dvc_repo.root_dir, "foo")
|
||||
|
||||
Repo.get(erepo.root_dir, src, dst)
|
||||
assert os.path.exists(dst + "/" + erepo.CODE)
|
||||
assert os.path.exists(dst)
|
||||
assert os.path.isfile(dst)
|
||||
assert filecmp.cmp(erepo.FOO, dst, shallow=False)
|
||||
|
||||
@@ -101,7 +101,6 @@ def test_get_from_non_dvc_master(erepo, tmp_path, monkeypatch, caplog):
|
||||
with caplog.at_level(logging.INFO, logger="dvc"):
|
||||
Repo.get(erepo._root_dir, erepo.FOO, out=imported_file, rev="branch")
|
||||
|
||||
assert caplog.text == ""
|
||||
assert filecmp.cmp(
|
||||
os.path.join(erepo._root_dir, erepo.FOO), imported_file, shallow=False
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user