mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-16 07:18:25 +01:00
tests: rename dvc repo fixture
This commit is contained in:
+23
-23
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user