|
1 | | -import filecmp |
2 | 1 | import os |
3 | 2 | from uuid import uuid4 |
4 | 3 |
|
5 | 4 | import pytest |
6 | 5 | from mock import patch |
7 | 6 |
|
8 | 7 | import dvc |
| 8 | +from dvc.compat import fspath |
9 | 9 | from dvc.main import main |
10 | 10 | from dvc.utils import makedirs |
11 | 11 | from tests.basic_env import TestDvc |
@@ -90,15 +90,16 @@ def test(self): |
90 | 90 |
|
91 | 91 |
|
92 | 92 | @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") |
95 | 96 |
|
96 | 97 | makedirs(dname, exist_ok=True) |
97 | 98 |
|
98 | | - stage = dvc_repo.imp_url(src, dname) |
| 99 | + stage = dvc.imp_url(src, dname) |
99 | 100 |
|
100 | | - dst = os.path.join(dname, os.path.basename(src)) |
| 101 | + dst = tmp_dir / dname / "file" |
101 | 102 |
|
102 | | - assert stage.outs[0].fspath == os.path.abspath(dst) |
| 103 | + assert stage.outs[0].fspath == fspath(dst) |
103 | 104 | 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