code: def test_run(tmp_dir, dvc, copy_script):
      tmp_dir.dvc_gen("foo", "foo")
      assert not os.path.exists(PROJECT_FILE)
      stage = dvc.run(
          cmd="python copy.py foo bar",
          deps=["foo", "copy.py"],
          outs=["bar"],
          name="copy-foo-to-bar",
      )
      assert isinstance(stage, PipelineStage)
      assert stage.name == "copy-foo-to-bar"
      assert os.path.exists(PROJECT_FILE)
      assert os.path.exists(LOCK_FILE)
      assert stage.cmd == "python copy.py foo bar"
      assert len(stage.deps) == 2
      assert len(stage.outs) == 1
  
      with pytest.raises(OutputDuplicationError):
          dvc.run(
              cmd="python copy.py foo bar",
              deps=["foo", "copy.py"],
              outs=["bar"],
              name="duplicate",
          )
  
imports: import logging
  import os
  import textwrap
  import uuid
  import pytest
  from funcy import get_in
  from dvc.cli import main
  from dvc.dependency import ParamsDependency
  from dvc.dependency.base import DependencyDoesNotExistError
  from dvc.dvcfile import LOCK_FILE, PROJECT_FILE, load_file
  from dvc.exceptions import ArgumentDuplicationError, CircularDependencyError, CyclicGraphError, InvalidArgumentError, OutputDuplicationError, OverlappingOutputPathsError
  from dvc.stage import PipelineStage
  from dvc.stage.exceptions import DuplicateStageName, InvalidStageName, StagePathNotDirectoryError, StagePathNotFoundError, StagePathOutsideError
  from dvc.utils.serialize import load_yaml
label_desc: Use image node_id 1 for calling a global function with example usage: test_run(tmp_dir, dvc, copy_script) without return types