The Gaudi Framework  v31r0 (aeb156f0)
GaudiTest.TempDir Class Reference

Public Member Functions

def __init__ (self, keep=False, chdir=False)
 
def __str__ (self)
 
def __del__ (self)
 
def __getattr__ (self, attr)
 

Public Attributes

 name
 

Private Attributes

 _keep
 
 _origdir
 

Detailed Description

Small class for temporary directories.
When instantiated, it creates a temporary directory and the instance
behaves as the string containing the directory name.
When the instance goes out of scope, it removes all the content of
the temporary directory (automatic clean-up).

Definition at line 189 of file GaudiTest.py.

Constructor & Destructor Documentation

def GaudiTest.TempDir.__init__ (   self,
  keep = False,
  chdir = False 
)

Definition at line 197 of file GaudiTest.py.

197  def __init__(self, keep=False, chdir=False):
198  self.name = tempfile.mkdtemp()
199  self._keep = keep
200  self._origdir = None
201  if chdir:
202  self._origdir = os.getcwd()
203  os.chdir(self.name)
204 
def __init__(self, keep=False, chdir=False)
Definition: GaudiTest.py:197
def GaudiTest.TempDir.__del__ (   self)

Definition at line 208 of file GaudiTest.py.

208  def __del__(self):
209  if self._origdir:
210  os.chdir(self._origdir)
211  if self.name and not self._keep:
212  shutil.rmtree(self.name)
213 
def __del__(self)
Definition: GaudiTest.py:208

Member Function Documentation

def GaudiTest.TempDir.__getattr__ (   self,
  attr 
)

Definition at line 214 of file GaudiTest.py.

214  def __getattr__(self, attr):
215  return getattr(self.name, attr)
216 
217 
def __getattr__(self, attr)
Definition: GaudiTest.py:214
def GaudiTest.TempDir.__str__ (   self)

Definition at line 205 of file GaudiTest.py.

205  def __str__(self):
206  return self.name
207 
def __str__(self)
Definition: GaudiTest.py:205

Member Data Documentation

GaudiTest.TempDir._keep
private

Definition at line 199 of file GaudiTest.py.

GaudiTest.TempDir._origdir
private

Definition at line 200 of file GaudiTest.py.

GaudiTest.TempDir.name

Definition at line 198 of file GaudiTest.py.


The documentation for this class was generated from the following file: