code: def test_temp_dir_sentinel():
      from os.path import join, isdir, exists
  
      basedir = "test_temp_dir_sentinel"
      fn = join(basedir, "foo", "bar")
      if exists(basedir):
          print(
              "Path %s exists, not running test_temp_dir_sentinel()"
              % basedir
          )
          return
      os.makedirs(basedir)
      eq_(get_closest_dir(fn)[0], basedir)
      eq_(get_closest_dir(fn)[1], "foo")
      sentinel = join(basedir, "foo.inuse")
      try:
          with temp_dir(fn, erase_after=True, with_sentinel=True):
              assert isdir(fn)
              assert exists(sentinel)
              # simulate work
              open(join(fn, "dummy.txt"), "w").close()
          # work file should be deleted together with directory
          assert not exists(fn)
          assert not exists(join(basedir, "foo"))
          # basedir should still exist, though!
          assert isdir(basedir)
      finally:
          if isdir(basedir):
              shutil.rmtree(basedir)
  
file_path: hyperopt/hyperopt/tests/unit/test_utils.py
imports: import numpy
  from nose.tools import raises, eq_
  import shutil
  import os
  from hyperopt.utils import fast_isin
  from hyperopt.utils import get_most_recent_inds
  from hyperopt.utils import temp_dir, working_dir, get_closest_dir, path_split_all
label_desc: Use image node_id 6 for calling a global function with example usage: test_temp_dir_sentinel() without return types