code: def test_subrepo(tmp_dir, request, scm, workspace):
      from dvc.testing.tmp_dir import make_subrepo
  
      subrepo = tmp_dir / "dir" / "repo"
      make_subrepo(subrepo, scm)
      request.addfinalizer(subrepo.dvc.close)
  
      subrepo.gen("copy.py", COPY_SCRIPT)
      subrepo.gen("params.yaml", "foo: 1")
  
      with subrepo.chdir():
          subrepo.dvc.run(
              cmd="python copy.py params.yaml metrics.yaml",
              metrics_no_cache=["metrics.yaml"],
              params=["foo"],
              name="copy-file",
              no_exec=True,
          )
          scm.add(
              [
                  subrepo / "dvc.yaml",
                  subrepo / "copy.py",
                  subrepo / "params.yaml",
              ]
          )
          scm.commit("init")
  
          results = subrepo.dvc.experiments.run(
              PROJECT_FILE, params=["foo=2"], tmp_dir=not workspace
          )
          assert results
  
      exp = first(results)
      ref_info = first(exp_refs_by_rev(scm, exp))
  
      fs = scm.get_fs(exp)
      for fname in ["metrics.yaml", "dvc.lock"]:
          assert fs.exists(f"dir/repo/{fname}")
      with fs.open(
          "dir/repo/metrics.yaml", mode="r", encoding="utf-8"
      ) as fobj:
          assert fobj.read().strip() == "foo: 2"
  
      assert (
          subrepo.dvc.experiments.get_exact_name([exp])[exp]
          == ref_info.name
      )
      assert resolve_rev(scm, ref_info.name) == exp
  
imports: import itertools
  import logging
  import os
  import stat
  from textwrap import dedent
  import pytest
  from configobj import ConfigObj
  from funcy import first
  from dvc.dvcfile import PROJECT_FILE
  from dvc.env import DVC_EXP_BASELINE_REV, DVC_EXP_NAME, DVC_ROOT, DVC_STUDIO_OFFLINE, DVC_STUDIO_REPO_URL, DVC_STUDIO_TOKEN, DVC_STUDIO_URL
  from dvc.exceptions import DvcException, ReproductionError
  from dvc.repo.experiments.exceptions import ExperimentExistsError
  from dvc.repo.experiments.queue.base import BaseStashQueue
  from dvc.repo.experiments.refs import CELERY_STASH
  from dvc.repo.experiments.utils import exp_refs_by_rev
  from dvc.scm import SCMError, resolve_rev
  from dvc.stage.exceptions import StageFileDoesNotExistError
  from dvc.testing.scripts import COPY_SCRIPT
  from dvc.utils.serialize import PythonFileCorruptedError
label_desc: Use image node_id 14 for calling a global function with example usage: test_subrepo(tmp_dir, request, scm, workspace) without return types