code: def test_run_env(tmp_dir, dvc, scm, mocker):
      dump_run_env = dedent(
          """\
          import os
          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
          )
          for v in (
              DVC_EXP_BASELINE_REV,
              DVC_EXP_NAME,
              DVC_ROOT,
              DVC_STUDIO_OFFLINE,
              DVC_STUDIO_REPO_URL,
              DVC_STUDIO_TOKEN,
              DVC_STUDIO_URL
          ):
              with open(v, "w") as f:
                  f.write(os.environ.get(v, ""))
          """
      )
      mocker.patch(
          "dvc.repo.experiments.queue.base.get_studio_config",
          return_value={
              "token": "TOKEN",
              "repo_url": "REPO_URL",
              "url": "BASE_URL",
              "offline": "false",
          },
      )
      (tmp_dir / "dump_run_env.py").write_text(dump_run_env)
      baseline = scm.get_rev()
      dvc.stage.add(
          cmd="python dump_run_env.py",
          name="run_env",
      )
      dvc.experiments.run()
      assert (
          tmp_dir / DVC_EXP_BASELINE_REV
      ).read_text().strip() == baseline
      assert (tmp_dir / DVC_EXP_NAME).read_text().strip()
      assert (tmp_dir / DVC_ROOT).read_text().strip() == dvc.root_dir
      assert (tmp_dir / DVC_STUDIO_TOKEN).read_text().strip() == "TOKEN"
      assert (
          tmp_dir / DVC_STUDIO_REPO_URL
      ).read_text().strip() == "REPO_URL"
      assert (
          tmp_dir / DVC_STUDIO_URL
      ).read_text().strip() == "BASE_URL"
      assert (
          tmp_dir / DVC_STUDIO_OFFLINE
      ).read_text().strip() == "false"
  
      dvc.experiments.run(name="foo")
      assert (
          tmp_dir / DVC_EXP_BASELINE_REV
      ).read_text().strip() == baseline
      assert (tmp_dir / DVC_EXP_NAME).read_text().strip() == "foo"
  
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 22 for calling a global function with example usage: test_run_env(tmp_dir, dvc, scm, mocker) without return types