mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
@@ -480,6 +480,8 @@ class Stage(object):
|
||||
|
||||
if not fname:
|
||||
fname = Stage._stage_fname(stage.outs, add=add)
|
||||
stage._check_dvc_filename(fname)
|
||||
|
||||
wdir = os.path.abspath(wdir)
|
||||
|
||||
if cwd is not None:
|
||||
|
||||
+14
-10
@@ -97,16 +97,6 @@ class TestRunMissingDep(TestDvc):
|
||||
|
||||
class TestRunBadStageFilename(TestDvc):
|
||||
def test(self):
|
||||
with self.assertRaises(StageFileBadNameError):
|
||||
self.dvc.run(
|
||||
cmd="",
|
||||
deps=[],
|
||||
outs=[],
|
||||
outs_no_cache=[],
|
||||
fname="empty",
|
||||
cwd=os.curdir,
|
||||
)
|
||||
|
||||
with self.assertRaises(StageFileBadNameError):
|
||||
self.dvc.run(
|
||||
cmd="",
|
||||
@@ -1000,3 +990,17 @@ class TestPersistentOutput(TestDvc):
|
||||
# it should run the command again, as it is "ignoring build cache"
|
||||
with open("greetings", "r") as fobj:
|
||||
assert "hello\nhello\n" == fobj.read()
|
||||
|
||||
|
||||
def test_bad_stage_fname(repo_dir, dvc_repo):
|
||||
dvc_repo.add(repo_dir.FOO)
|
||||
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
|
||||
)
|
||||
|
||||
# Check that command hasn't been run
|
||||
assert not os.path.exists("out")
|
||||
|
||||
Reference in New Issue
Block a user