Skip to content

Commit

Permalink
test: drop repo_template fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Suor committed Jan 20, 2020
1 parent 7d65002 commit 4117206
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
15 changes: 1 addition & 14 deletions tests/dir_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,7 @@
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):
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion tests/func/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ def test(self):
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")
Expand Down
10 changes: 5 additions & 5 deletions tests/func/test_gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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")
Expand Down

0 comments on commit 4117206

Please sign in to comment.