fixed test case

This commit is contained in:
Mayur Kularni
2019-12-09 12:11:49 +05:30
parent 84616e8e5e
commit 5b9daea2b3
3 changed files with 9 additions and 5 deletions
+3 -1
View File
@@ -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)
+6 -3
View File
@@ -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)
-1
View File
@@ -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
)