From a6cdb9efd2a8b0e292f5e22cf05bd387706add1c Mon Sep 17 00:00:00 2001 From: Ronan Lamy Date: Fri, 30 Sep 2022 17:54:41 +0100 Subject: [PATCH] ls-url: remove redundant tests --- tests/func/test_ls_url.py | 51 --------------------------------------- 1 file changed, 51 deletions(-) diff --git a/tests/func/test_ls_url.py b/tests/func/test_ls_url.py index cd4dbbdb2..4478cdd66 100644 --- a/tests/func/test_ls_url.py +++ b/tests/func/test_ls_url.py @@ -1,56 +1,5 @@ -import os - -import pytest - -from dvc.exceptions import URLMissingError -from dvc.repo import Repo from dvc.testing.workspace_tests import TestLsUrl as _TestLsUrl -def match_files(entries, expected): - entries_content = {(d["path"], d["isdir"]) for d in entries} - expected_content = { - (os.path.normpath(d["path"]), d["isdir"]) for d in expected - } - assert entries_content == expected_content - - -@pytest.mark.parametrize("fname", ["foo", "foo.dvc", "dir/foo"]) -def test_file(tmp_dir, fname): - tmp_dir.gen({fname: "foo contents"}) - - (d,) = Repo.ls_url(fname) - assert d["isdir"] is False - assert os.path.normpath(d["path"]) == os.path.abspath(fname) - - -def test_dir(tmp_dir): - tmp_dir.gen({"dir/foo": "foo contents", "dir/subdir/bar": "bar contents"}) - - result = Repo.ls_url("dir") - match_files( - result, - [{"path": "foo", "isdir": False}, {"path": "subdir", "isdir": True}], - ) - - -def test_recursive(tmp_dir): - tmp_dir.gen({"dir/foo": "foo contents", "dir/subdir/bar": "bar contents"}) - - result = Repo.ls_url("dir", recursive=True) - match_files( - result, - [ - {"path": "foo", "isdir": False}, - {"path": "subdir/bar", "isdir": False}, - ], - ) - - -def test_nonexistent(tmp_dir): - with pytest.raises(URLMissingError): - Repo.ls_url("nonexistent") - - class TestLsUrl(_TestLsUrl): pass