class_docstr: Create and auto-destroy temp dir.
  
  This is designed to be used with testing modules. Instances should be
  defined inside test functions. Instances defined at module level can not
  guarantee proper destruction of the temporary directory.
  
  When used at module level, the current use of the __del__() method for
  cleanup can fail because the rmtree function may be cleaned up before this
  object (an alternative could be using the atexit module instead).
class_docstr_tok: ["Create","and","auto-destroy","temp","dir",".","This","is","designed","to","be","used","with","testing","modules",".","Instances","should","be","defined","inside","test","functions",".","Instances","defined","at","module","level","can","not","guarantee","proper","destruction","of","the","temporary","directory",".","When","used","at","module","level",",","the","current","use","of","the","__del__","(",")","method","for","cleanup","can","fail","because","the","rmtree","function","may","be","cleaned","up","before","this","object","(","an","alternative","could","be","using","the","atexit","module","instead",")","."]
code: def __init__(self):
      self._path = self.__str__()
  
imports: import inspect
  import os
  import sys
  import tempfile
  import traceback
  from functools import wraps
  from io import StringIO
  from shutil import rmtree
  from unittest import SkipTest
  import numpy
  from numpy.testing import assert_allclose, assert_array_equal
  from scipy import linalg
  from ._logging import ClosingStringIO, warn
  from .check import check_version
  from .misc import run_subprocess
  from .numerics import object_diff
label_desc: Use image node_id 2 to create a new _TempDir object from inherited base classes: str with example: obj = _TempDir()