tests: rename dvc repo fixture

This commit is contained in:
pawel
2019-05-21 15:04:43 -07:00
parent 3e461f8f11
commit 01c2f6c174
12 changed files with 70 additions and 70 deletions
+23 -23
View File
@@ -4,51 +4,51 @@ from dvc.utils.stage import load_stage_file, dump_stage_file
from dvc.stage import StageCommitError
def test_commit_recursive(dvc, repo_dir):
stages = dvc.add(repo_dir.DATA_DIR, recursive=True, no_commit=True)
def test_commit_recursive(dvc_repo, repo_dir):
stages = dvc_repo.add(repo_dir.DATA_DIR, recursive=True, no_commit=True)
assert len(stages) == 2
assert dvc.status() != {}
assert dvc_repo.status() != {}
dvc.commit(repo_dir.DATA_DIR, recursive=True)
dvc_repo.commit(repo_dir.DATA_DIR, recursive=True)
assert dvc.status() == {}
assert dvc_repo.status() == {}
def test_commit_force(dvc, repo_dir):
stages = dvc.add(repo_dir.FOO, no_commit=True)
def test_commit_force(dvc_repo, repo_dir):
stages = dvc_repo.add(repo_dir.FOO, no_commit=True)
assert len(stages) == 1
stage = stages[0]
with dvc.state:
with dvc_repo.state:
assert stage.outs[0].changed_cache()
with open(repo_dir.FOO, "a") as fobj:
fobj.write(repo_dir.FOO_CONTENTS)
with dvc.state:
with dvc_repo.state:
assert stage.outs[0].changed_cache()
with pytest.raises(StageCommitError):
dvc.commit(stage.path)
dvc_repo.commit(stage.path)
with dvc.state:
with dvc_repo.state:
assert stage.outs[0].changed_cache()
dvc.commit(stage.path, force=True)
dvc_repo.commit(stage.path, force=True)
assert dvc.status(stage.path) == {}
assert dvc_repo.status(stage.path) == {}
def test_commit_with_deps(dvc, repo_dir):
stages = dvc.add(repo_dir.FOO, no_commit=True)
def test_commit_with_deps(dvc_repo, repo_dir):
stages = dvc_repo.add(repo_dir.FOO, no_commit=True)
assert len(stages) == 1
foo_stage = stages[0]
assert foo_stage is not None
assert len(foo_stage.outs) == 1
fname = "file"
stage = dvc.run(
stage = dvc_repo.run(
cmd="python {} {} {}".format(repo_dir.CODE, repo_dir.FOO, fname),
outs=[fname],
deps=[repo_dir.FOO, repo_dir.CODE],
@@ -57,18 +57,18 @@ def test_commit_with_deps(dvc, repo_dir):
assert stage is not None
assert len(stage.outs) == 1
with dvc.state:
with dvc_repo.state:
assert foo_stage.outs[0].changed_cache()
assert stage.outs[0].changed_cache()
dvc.commit(stage.path, with_deps=True)
with dvc.state:
dvc_repo.commit(stage.path, with_deps=True)
with dvc_repo.state:
assert not foo_stage.outs[0].changed_cache()
assert not stage.outs[0].changed_cache()
def test_commit_changed_md5(dvc, repo_dir):
stages = dvc.add(repo_dir.FOO, no_commit=True)
def test_commit_changed_md5(dvc_repo, repo_dir):
stages = dvc_repo.add(repo_dir.FOO, no_commit=True)
assert len(stages) == 1
stage = stages[0]
@@ -77,6 +77,6 @@ def test_commit_changed_md5(dvc, repo_dir):
dump_stage_file(stage.path, stage_file_content)
with pytest.raises(StageCommitError):
dvc.commit(stage.path)
dvc_repo.commit(stage.path)
dvc.commit(stage.path, force=True)
dvc_repo.commit(stage.path, force=True)