Skip to content

Commit

Permalink
run: tests: migrate to helpers all besides deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
pared committed Jan 10, 2020
1 parent 84ec0d4 commit 6d61e62
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions tests/func/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,33 +931,24 @@ def test_ignore_build_cache(self):
assert "hello\nhello\n" == fobj.read()


def test_bad_stage_fname(repo_dir, dvc_repo):
dvc_repo.add(repo_dir.FOO)
def test_bad_stage_fname(tmp_dir, dvc, run_copy):
tmp_dir.dvc_gen("foo", "foo content")

with pytest.raises(StageFileBadNameError):
dvc_repo.run(
cmd="python {} {} {}".format(repo_dir.CODE, repo_dir.FOO, "out"),
deps=[repo_dir.FOO, repo_dir.CODE],
outs=["out"],
fname="out_stage", # Bad name, should end with .dvc
)
# fname should end with .dvc
run_copy("foo", "foo_copy", fname="out_stage")

# Check that command hasn't been run
assert not os.path.exists("out")
assert not (tmp_dir / "foo_copy").exists()


def test_should_raise_on_stage_dependency(repo_dir, dvc_repo):
def test_should_raise_on_stage_dependency(run_copy):
with pytest.raises(DependencyIsStageFileError):
dvc_repo.run(
cmd="python {} {} {}".format(repo_dir.CODE, repo_dir.FOO, "out"),
deps=[repo_dir.FOO, "name.dvc"],
outs=["out"],
)
run_copy("name.dvc", "stage_copy")


def test_should_raise_on_stage_output(repo_dir, dvc_repo):
def test_should_raise_on_stage_output(tmp_dir, dvc, run_copy):
tmp_dir.dvc_gen("foo", "foo content")

with pytest.raises(OutputIsStageFileError):
dvc_repo.run(
cmd="python {} {} {}".format(repo_dir.CODE, repo_dir.FOO, "out"),
deps=[repo_dir.FOO],
outs=["name.dvc"],
)
run_copy("foo", "name.dvc")

0 comments on commit 6d61e62

Please sign in to comment.