Skip to content

Commit

Permalink
erepo: improve relative remote tests (iterative#2756)
Browse files Browse the repository at this point in the history
- use `tmp_dir` fixture
- commit config file changes
  • Loading branch information
tizoc committed Feb 24, 2020
1 parent 9b6261f commit 80bd6eb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/func/test_external_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,23 @@ def test_pull_subdir_file(tmp_dir, erepo_dir):
assert dest.read_text() == "contents"


def test_relative_remote(erepo_dir, tmp_path_factory):
def test_relative_remote(erepo_dir, tmp_dir):
# these steps reproduce the script on this issue:
# https://github.com/iterative/dvc/issues/2756
with erepo_dir.chdir():
erepo_dir.dvc_gen("file", "contents", commit="create file")

upstream_dir = fspath(tmp_path_factory.mktemp("upstream"))
upstream_dir = tmp_dir
upstream_url = relpath(upstream_dir, erepo_dir)
with erepo_dir.dvc.config.edit() as conf:
conf["remote"]["upstream"] = {"url": upstream_url}
conf["core"]["remote"] = "upstream"

erepo_dir.scm_add(erepo_dir.dvc.config.files["repo"])
erepo_dir.scm.commit("Update dvc config")
erepo_dir.dvc.push()

with erepo_dir.chdir():
os.remove("file")
(erepo_dir / "file").unlink()
shutil.rmtree(erepo_dir.dvc.cache.local.cache_dir)

url = fspath(erepo_dir)
Expand Down

0 comments on commit 80bd6eb

Please sign in to comment.