code: def test_cache_dir(tmp_path, numba_conditional):
      """Test use of cache dir."""
      tempdir = str(tmp_path)
      orig_dir = os.getenv("MNE_CACHE_DIR", None)
      orig_size = os.getenv("MNE_MEMMAP_MIN_SIZE", None)
      rng = np.random.RandomState(0)
      X = rng.randn(9, 2, 10)
      try:
          os.environ["MNE_MEMMAP_MIN_SIZE"] = "1K"
          os.environ["MNE_CACHE_DIR"] = tempdir
          # Fix error for #1507: in-place when memmapping
          with catch_logging() as log_file:
              permutation_cluster_1samp_test(
                  X,
                  buffer_size=None,
                  n_jobs=2,
                  n_permutations=1,
                  seed=0,
                  stat_fun=ttest_1samp_no_p,
                  verbose=False,
                  out_type="mask",
              )
          assert "independently" not in log_file.getvalue()
          # ensure that non-independence yields warning
          stat_fun = partial(ttest_1samp_no_p, sigma=1e-3)
          random_state = np.random.default_rng(0)
          with pytest.warns(RuntimeWarning, match="independently"):
              permutation_cluster_1samp_test(
                  X,
                  buffer_size=10,
                  n_jobs=2,
                  n_permutations=1,
                  seed=random_state,
                  stat_fun=stat_fun,
                  verbose=False,
                  out_type="mask",
              )
      finally:
          if orig_dir is not None:
              os.environ["MNE_CACHE_DIR"] = orig_dir
          else:
              del os.environ["MNE_CACHE_DIR"]
          if orig_size is not None:
              os.environ["MNE_MEMMAP_MIN_SIZE"] = orig_size
          else:
              del os.environ["MNE_MEMMAP_MIN_SIZE"]
  
imports: import os
  from functools import partial
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import linalg, sparse, stats
  from mne import MixedSourceEstimate, SourceEstimate, SourceSpaces, VolSourceEstimate
  from mne.stats import combine_adjacency, ttest_ind_no_p
  from mne.stats.cluster_level import f_oneway, permutation_cluster_1samp_test, permutation_cluster_test, spatio_temporal_cluster_1samp_test, spatio_temporal_cluster_test, summarize_clusters_stc, ttest_1samp_no_p
  from mne.utils import _record_warnings, catch_logging
label_desc: Use image node_id 3 for calling a global function with example usage: test_cache_dir(tmp_path, numba_conditional) without return types