tahoe_fuse: system test: factor out some cleanup code.

This commit is contained in:
the real nejucomo 2008-01-20 17:54:48 -07:00
parent c7a557ba69
commit c225c657d4
1 changed files with 8 additions and 10 deletions

View File

@ -96,11 +96,7 @@ class SystemTest (object):
finally: finally:
print 'Removing introducer directory.' print 'Removing introducer directory.'
try: self.cleanup_dir(self.introbase)
shutil.rmtree(self.introbase)
except Exception, e:
print 'Exception removing test client directory: %r' % (self.introbase,)
print 'Ignoring cleanup exception: %r' % (e,)
def launch_introducer_layer(self): def launch_introducer_layer(self):
print 'Launching introducer.' print 'Launching introducer.'
@ -136,11 +132,7 @@ class SystemTest (object):
finally: finally:
print 'Removing client directory.' print 'Removing client directory.'
try: self.cleanup_dir(self.clientbase)
shutil.rmtree(self.clientbase)
except Exception, e:
print 'Exception removing test client directory: %r' % (self.clientbase,)
print 'Ignoring cleanup exception: %r' % (e,)
def configure_client_layer(self): def configure_client_layer(self):
print 'Configuring client.' print 'Configuring client.'
@ -224,6 +216,12 @@ class SystemTest (object):
tmpl += 'Actual directory: %r\n' tmpl += 'Actual directory: %r\n'
raise self.SetupFailure(tmpl, expdir, m.group(1)) raise self.SetupFailure(tmpl, expdir, m.group(1))
def cleanup_dir(self, path):
try:
shutil.rmtree(path)
except Exception, e:
print 'Exception removing test directory: %r' % (path,)
print 'Ignoring cleanup exception: %r' % (e,)
# SystemTest Exceptions: # SystemTest Exceptions:
class Failure (Exception): class Failure (Exception):