From 62d6f4dbdb910f1e6c18e577652de72865e5b2e7 Mon Sep 17 00:00:00 2001 From: pawel Date: Mon, 6 Jan 2020 17:01:40 +0100 Subject: [PATCH] import url: test: migrate to dir helpers --- tests/func/test_import_url.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/func/test_import_url.py b/tests/func/test_import_url.py index de212da73c..20639ca9ae 100644 --- a/tests/func/test_import_url.py +++ b/tests/func/test_import_url.py @@ -1,4 +1,3 @@ -import filecmp import os from uuid import uuid4 @@ -6,6 +5,7 @@ from mock import patch import dvc +from dvc.compat import fspath from dvc.main import main from dvc.utils import makedirs from tests.basic_env import TestDvc @@ -90,15 +90,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].fspath == fspath(dst) assert os.path.isdir(dname) - assert filecmp.cmp(repo_dir.DATA, dst, shallow=False) + assert (tmp_dir / dname / "file").read_text() == "file content"