The Gaudi Framework  v29r0 (ff2e7097)
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 187 of file GaudiTest.py.

Constructor & Destructor Documentation

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

Definition at line 195 of file GaudiTest.py.

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

Definition at line 206 of file GaudiTest.py.

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

Member Function Documentation

def GaudiTest.TempDir.__getattr__ (   self,
  attr 
)

Definition at line 212 of file GaudiTest.py.

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

Definition at line 203 of file GaudiTest.py.

203  def __str__(self):
204  return self.name
205 
def __str__(self)
Definition: GaudiTest.py:203

Member Data Documentation

GaudiTest.TempDir._keep
private

Definition at line 197 of file GaudiTest.py.

GaudiTest.TempDir._origdir
private

Definition at line 198 of file GaudiTest.py.

GaudiTest.TempDir.name

Definition at line 196 of file GaudiTest.py.


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