From 4117206c67e1d1ee32fb1649112b190defc78f24 Mon Sep 17 00:00:00 2001 From: Alexander Schepanovski Date: Mon, 20 Jan 2020 11:49:13 +0700 Subject: [PATCH] test: drop repo_template fixture --- tests/dir_helpers.py | 15 +-------------- tests/func/test_add.py | 4 +++- tests/func/test_gc.py | 10 +++++----- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/tests/dir_helpers.py b/tests/dir_helpers.py index c531e4b8c..54a25b6aa 100644 --- a/tests/dir_helpers.py +++ b/tests/dir_helpers.py @@ -54,15 +54,7 @@ from dvc.utils.fs import makedirs from dvc.compat import fspath, fspath_py35 -__all__ = ["tmp_dir", "scm", "dvc", "repo_template", "run_copy", "erepo_dir"] -REPO_TEMPLATE = { - "foo": "foo", - "bar": "bar", - "dir": { - "data": "dir/data text", - "subdir": {"subdata": "dir/subdir/subdata text"}, - }, -} +__all__ = ["tmp_dir", "scm", "dvc", "run_copy", "erepo_dir"] class TmpDir(pathlib.Path): @@ -236,11 +228,6 @@ def dvc(tmp_dir, request): dvc.close() -@pytest.fixture -def repo_template(tmp_dir): - tmp_dir.gen(REPO_TEMPLATE) - - @pytest.fixture def run_copy(tmp_dir, dvc, request): tmp_dir.gen( diff --git a/tests/func/test_add.py b/tests/func/test_add.py index 1c885ead7..18d77d39e 100644 --- a/tests/func/test_add.py +++ b/tests/func/test_add.py @@ -463,7 +463,9 @@ class TestAddFilename(TestDvc): self.assertFalse(os.path.exists("foo.dvc")) -def test_should_cleanup_after_failed_add(tmp_dir, scm, dvc, repo_template): +def test_failed_add_cleanup(tmp_dir, scm, dvc): + tmp_dir.gen({"foo": "foo", "bar": "bar"}) + # Add and corrupt a stage file dvc.add("foo") tmp_dir.gen("foo.dvc", "- broken\nyaml") diff --git a/tests/func/test_gc.py b/tests/func/test_gc.py index 688f11396..41c4f2204 100644 --- a/tests/func/test_gc.py +++ b/tests/func/test_gc.py @@ -189,9 +189,9 @@ def test_all_commits(tmp_dir, scm, dvc): assert _count_files(dvc.cache.local.cache_dir) == n - 1 -def test_gc_no_dir_cache(tmp_dir, dvc, repo_template): - dvc.add(["foo", "bar"]) - dir_stage, = dvc.add("dir") +def test_gc_no_dir_cache(tmp_dir, dvc): + tmp_dir.dvc_gen({"foo": "foo", "bar": "bar"}) + dir_stage, = tmp_dir.dvc_gen({"dir": {"x": "x", "subdir": {"y": "y"}}}) os.unlink(dir_stage.outs[0].cache_path) @@ -207,8 +207,8 @@ def _count_files(path): return sum(len(files) for _, _, files in os.walk(path)) -def test_gc_no_unpacked_dir(tmp_dir, dvc, repo_template): - dir_stages = dvc.add("dir") +def test_gc_no_unpacked_dir(tmp_dir, dvc): + dir_stages = tmp_dir.dvc_gen({"dir": {"file": "text"}}) dvc.status() os.remove("dir.dvc")