code: def test_external_outs(tmp_path_factory, dvc):
      from dvc.stage import create_stage
      from dvc.stage.exceptions import StageExternalOutputsError
  
      tmp_path = tmp_path_factory.mktemp("external-outs")
      foo = tmp_path / "foo"
      foo.write_text("foo")
  
      with pytest.raises(StageExternalOutputsError):
          create_stage(Stage, dvc, "path.dvc", outs=[os.fspath(foo)])
  
      with dvc.config.edit() as conf:
          conf["remote"]["myremote"] = {"url": os.fspath(tmp_path)}
  
      with pytest.raises(StageExternalOutputsError):
          create_stage(
              Stage, dvc, "path.dvc", outs=["remote://myremote/foo"]
          )
  
      create_stage(
          Stage,
          dvc,
          "path.dvc",
          outs_no_cache=["remote://myremote/foo"],
      )
      create_stage(
          Stage, dvc, "path.dvc", outs_no_cache=[os.fspath(foo)]
      )
  
file_path: dvc/tests/unit/stage/test_stage.py
imports: import os
  import signal
  import subprocess
  import threading
  import pytest
  from dvc.dependency.repo import RepoDependency
  from dvc.stage import Stage
  from dvc.stage.exceptions import StageUpdateError
label_desc: Use image node_id 9 for calling a global function with example usage: test_external_outs(tmp_path_factory, dvc) without return types