From: nejucomo <nejucomo@gmail.com>
Date: Mon, 21 Jan 2008 00:54:48 +0000 (-0700)
Subject: tahoe_fuse: system test: factor out some cleanup code.
X-Git-Tag: allmydata-tahoe-0.8.0~243
X-Git-Url: https://git.rkrishnan.org/%5B/frontends/%22file:/%22doc.html/using.html?a=commitdiff_plain;h=c225c657d4280015e26dd22bdfad2756f4b8a900;p=tahoe-lafs%2Ftahoe-lafs.git

tahoe_fuse: system test: factor out some cleanup code.
---

diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py
index 5c55d9bd..41ec4a34 100644
--- a/contrib/fuse/runtests.py
+++ b/contrib/fuse/runtests.py
@@ -96,11 +96,7 @@ class SystemTest (object):
             
         finally:
             print 'Removing introducer directory.'
-            try:
-                shutil.rmtree(self.introbase)
-            except Exception, e:
-                print 'Exception removing test client directory: %r' % (self.introbase,)
-                print 'Ignoring cleanup exception: %r' % (e,)
+            self.cleanup_dir(self.introbase)
     
     def launch_introducer_layer(self):
         print 'Launching introducer.'
@@ -136,11 +132,7 @@ class SystemTest (object):
             
         finally:
             print 'Removing client directory.'
-            try:
-                shutil.rmtree(self.clientbase)
-            except Exception, e:
-                print 'Exception removing test client directory: %r' % (self.clientbase,)
-                print 'Ignoring cleanup exception: %r' % (e,)
+            self.cleanup_dir(self.clientbase)
     
     def configure_client_layer(self):
         print 'Configuring client.'
@@ -224,6 +216,12 @@ class SystemTest (object):
             tmpl += 'Actual directory: %r\n'
             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:
     class Failure (Exception):