def with_rw_directory(func):
 @wraps(func)
 def wrapper(self):
  path = tempfile.mktemp(prefix=func.__name__)
  os.mkdir(path)
  keep = False
  try:
   return func(self, path)
  except Exception:
   log.info('Test %s.%s failed, output is at %r\n', type(self).__name__, func.__name__, path)
   keep = True
   raise
  finally:
   import gc
   gc.collect()
   if (not keep):
    rmtree(path)
 return wrapper

def with_rw_directory ( func ) : @ wraps ( func ) def wrapper ( self ) : path = tempfile . mktemp ( prefix = func . __name__ ) os . mkdir ( path ) keep = False try : return func ( self , path ) except Exception : log . info ( 'Test %s.%s failed, output is at %r\n' , type ( self ) . __name__ , func . __name__ , path ) keep = True raise finally : import gc gc . collect ( ) if ( not keep ) : rmtree ( path ) return wrapper
create a temporary directory which can be written to .