Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import url: test: migrate to dir helpers #3072

Merged
merged 4 commits into from
Jan 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/func/test_import_url.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import filecmp
import os
from uuid import uuid4

Expand Down Expand Up @@ -90,15 +89,16 @@ def test(self):


@pytest.mark.parametrize("dname", [".", "dir", "dir/subdir"])
def test_import_url_to_dir(dname, repo_dir, dvc_repo):
src = repo_dir.DATA
def test_import_url_to_dir(dname, tmp_dir, dvc):
tmp_dir.gen({"data_dir": {"file": "file content"}})
src = os.path.join("data_dir", "file")

makedirs(dname, exist_ok=True)

stage = dvc_repo.imp_url(src, dname)
stage = dvc.imp_url(src, dname)

dst = os.path.join(dname, os.path.basename(src))
dst = tmp_dir / dname / "file"

assert stage.outs[0].fspath == os.path.abspath(dst)
assert stage.outs[0].path_info == dst
assert os.path.isdir(dname)
assert filecmp.cmp(repo_dir.DATA, dst, shallow=False)
assert dst.read_text() == "file content"