code: def test_make_scalp_surfaces(tmp_path, monkeypatch):
      """Test mne make_scalp_surfaces."""
      pytest.importorskip("nibabel")
      pytest.importorskip("pyvista")
      check_usage(mne_make_scalp_surfaces)
      has = "SUBJECTS_DIR" in os.environ
      # Copy necessary files to avoid FreeSurfer call
      tempdir = str(tmp_path)
      surf_path = op.join(subjects_dir, "sample", "surf")
      surf_path_new = op.join(tempdir, "sample", "surf")
      os.mkdir(op.join(tempdir, "sample"))
      os.mkdir(surf_path_new)
      subj_dir = op.join(tempdir, "sample", "bem")
      os.mkdir(subj_dir)
  
      cmd = ("-s", "sample", "--subjects-dir", tempdir)
      monkeypatch.setattr(
          mne.bem,
          "decimate_surface",
          lambda points, triangles, n_triangles: (points, triangles),
      )
      dense_fname = op.join(subj_dir, "sample-head-dense.fif")
      medium_fname = op.join(subj_dir, "sample-head-medium.fif")
      with ArgvSetter(cmd, disable_stdout=False, disable_stderr=False):
          monkeypatch.delenv("FREESURFER_HOME")
          with pytest.raises(
              RuntimeError, match="The FreeSurfer environ"
          ):
              mne_make_scalp_surfaces.run()
          shutil.copy(op.join(surf_path, "lh.seghead"), surf_path_new)
          monkeypatch.setenv("FREESURFER_HOME", tempdir)
          mne_make_scalp_surfaces.run()
          assert op.isfile(dense_fname)
          assert op.isfile(medium_fname)
          with pytest.raises(OSError, match="overwrite"):
              mne_make_scalp_surfaces.run()
      # actually check the outputs
      head_py = read_bem_surfaces(dense_fname)
      assert_equal(len(head_py), 1)
      head_py = head_py[0]
      head_c = read_bem_surfaces(
          op.join(
              subjects_dir, "sample", "bem", "sample-head-dense.fif"
          )
      )[0]
      assert_allclose(head_py["rr"], head_c["rr"])
      if not has:
          assert "SUBJECTS_DIR" not in os.environ
  
imports: import glob
  import os
  import shutil
  from os import path
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_equal
  import mne
  from mne import concatenate_raws, read_bem_solution, read_bem_surfaces, read_source_spaces, read_surface
  from mne.bem import ConductorModel, convert_flash_mris
  from mne.commands import mne_anonymize, mne_browse_raw, mne_bti2fiff, mne_clean_eog_ecg, mne_compare_fiff, mne_compute_proj_ecg, mne_compute_proj_eog, mne_coreg, mne_flash_bem, mne_kit2fiff, mne_make_scalp_surfaces, mne_prepare_bem_model, mne_report, mne_setup_forward_model, mne_setup_source_space, mne_show_fiff, mne_show_info, mne_surf2bem, mne_sys_info, mne_watershed_bem, mne_what
  from mne.datasets import testing
  from mne.io import read_info, read_raw_fif, show_fiff
  from mne.utils import ArgvSetter, _record_warnings, _stamp_to_dt, requires_freesurfer, requires_mne
label_desc: Use image node_id 11 for calling a global function with example usage: test_make_scalp_surfaces(tmp_path, monkeypatch) without return types