Skip to content

Commit 62d6f4d

Browse files
committed
import url: test: migrate to dir helpers
1 parent 2966924 commit 62d6f4d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/func/test_import_url.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import filecmp
21
import os
32
from uuid import uuid4
43

54
import pytest
65
from mock import patch
76

87
import dvc
8+
from dvc.compat import fspath
99
from dvc.main import main
1010
from dvc.utils import makedirs
1111
from tests.basic_env import TestDvc
@@ -90,15 +90,16 @@ def test(self):
9090

9191

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

9697
makedirs(dname, exist_ok=True)
9798

98-
stage = dvc_repo.imp_url(src, dname)
99+
stage = dvc.imp_url(src, dname)
99100

100-
dst = os.path.join(dname, os.path.basename(src))
101+
dst = tmp_dir / dname / "file"
101102

102-
assert stage.outs[0].fspath == os.path.abspath(dst)
103+
assert stage.outs[0].fspath == fspath(dst)
103104
assert os.path.isdir(dname)
104-
assert filecmp.cmp(repo_dir.DATA, dst, shallow=False)
105+
assert (tmp_dir / dname / "file").read_text() == "file content"

0 commit comments

Comments
 (0)