@@ -931,33 +931,24 @@ def test_ignore_build_cache(self):
931931 assert "hello\n hello\n " == fobj .read ()
932932
933933
934- def test_bad_stage_fname (repo_dir , dvc_repo ):
935- dvc_repo .add (repo_dir .FOO )
934+ def test_bad_stage_fname (tmp_dir , dvc , run_copy ):
935+ tmp_dir .dvc_gen ("foo" , "foo content" )
936+
936937 with pytest .raises (StageFileBadNameError ):
937- dvc_repo .run (
938- cmd = "python {} {} {}" .format (repo_dir .CODE , repo_dir .FOO , "out" ),
939- deps = [repo_dir .FOO , repo_dir .CODE ],
940- outs = ["out" ],
941- fname = "out_stage" , # Bad name, should end with .dvc
942- )
938+ # fname should end with .dvc
939+ run_copy ("foo" , "foo_copy" , fname = "out_stage" )
943940
944941 # Check that command hasn't been run
945- assert not os . path . exists ( "out" )
942+ assert not ( tmp_dir / "foo_copy" ). exists ( )
946943
947944
948- def test_should_raise_on_stage_dependency (repo_dir , dvc_repo ):
945+ def test_should_raise_on_stage_dependency (run_copy ):
949946 with pytest .raises (DependencyIsStageFileError ):
950- dvc_repo .run (
951- cmd = "python {} {} {}" .format (repo_dir .CODE , repo_dir .FOO , "out" ),
952- deps = [repo_dir .FOO , "name.dvc" ],
953- outs = ["out" ],
954- )
947+ run_copy ("name.dvc" , "stage_copy" )
955948
956949
957- def test_should_raise_on_stage_output (repo_dir , dvc_repo ):
950+ def test_should_raise_on_stage_output (tmp_dir , dvc , run_copy ):
951+ tmp_dir .dvc_gen ("foo" , "foo content" )
952+
958953 with pytest .raises (OutputIsStageFileError ):
959- dvc_repo .run (
960- cmd = "python {} {} {}" .format (repo_dir .CODE , repo_dir .FOO , "out" ),
961- deps = [repo_dir .FOO ],
962- outs = ["name.dvc" ],
963- )
954+ run_copy ("foo" , "name.dvc" )
0 commit comments