From: nejucomo Date: Sat, 7 Jun 2008 07:07:18 +0000 (-0700) Subject: fuse: runtests: Wrap OSError exceptions which are test failures. X-Git-Tag: allmydata-tahoe-1.1.0~34 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/css/rgr-080307.php?a=commitdiff_plain;h=171b430afbfb6da0d98cd70b2831b20971371b66;p=tahoe-lafs%2Ftahoe-lafs.git fuse: runtests: Wrap OSError exceptions which are test failures. --- diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py index c1908220..fe47983d 100644 --- a/contrib/fuse/runtests.py +++ b/contrib/fuse/runtests.py @@ -283,7 +283,7 @@ class SystemTest (object): raise TestFailure('Attached test directory not found: %r', testdir) def test_empty_directory_listing(self, testcap, testdir): - listing = os.listdir(testdir) + listing = wrap_os_error(os.listdir, testdir) if listing: raise TestFailure('Expected empty directory, found: %r', listing) @@ -308,14 +308,14 @@ class SystemTest (object): names.sort() - listing = os.listdir(testdir) + listing = wrap_os_error(os.listdir, testdir) listing.sort() if listing != names: tmpl = 'Expected directory list containing %r but fuse gave %r' raise TestFailure(tmpl, names, listing) for file, size in filesizes.items(): - st = os.stat(os.path.join(testdir, file)) + st = wrap_os_error(os.stat, os.path.join(testdir, file)) if st.st_size != size: tmpl = 'Expected %r size of %r but fuse returned %r' raise TestFailure(tmpl, file, size, st.st_size) @@ -497,6 +497,13 @@ def gather_output(*args, **kwargs): return (exitcode, output) +def wrap_os_error(meth, *args): + try: + return meth(*args) + except os.error, e: + raise TestFailure('%s', e) + + ExpectedCreationOutput = r'(introducer|client) created in (?P.*?)\n' ExpectedStartOutput = r'STARTING (?P.*?)\n(introducer|client) node probably started'