]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Fix some potential bugs in test code exposed by check-miscaptures.py. refs #1556
authordavid-sarah <david-sarah@jacaranda.org>
Fri, 7 Oct 2011 02:34:43 +0000 (19:34 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Fri, 7 Oct 2011 02:34:43 +0000 (19:34 -0700)
src/allmydata/test/test_cli.py
src/allmydata/test/test_dirnode.py
src/allmydata/test/test_download.py

index 6cc70b0f6ec80e4a0b65af77c0d45eb24a837e8e..f9acbc0630a9c0eb61f8a0b1071d6968523181c2 100644 (file)
@@ -757,9 +757,9 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
             self.failUnlessIn("cannot contain", stderr)
 
         for invalid in ['foo:bar', 'foo bar', 'foobar::']:
-            d.addCallback(lambda res: self.do_cli("create-alias", invalid))
+            d.addCallback(lambda res, invalid=invalid: self.do_cli("create-alias", invalid))
             d.addCallback(_check_invalid)
-            d.addCallback(lambda res: self.do_cli("add-alias", invalid, self.two_uri))
+            d.addCallback(lambda res, invalid=invalid: self.do_cli("add-alias", invalid, self.two_uri))
             d.addCallback(_check_invalid)
 
         def _test_urls(junk):
index 8bea7d05de90a9c5931a7f9ea6eca59e226d05b7..187f25369b4979ba0939307c10eaafdde1a4e452 100644 (file)
@@ -1710,16 +1710,16 @@ class Dirnode2(testutil.ReallyEqualMixin, testutil.ShouldFailMixin, unittest.Tes
             n.raise_error()
 
         for (i, n) in unknown_rw:
-            self.failUnlessRaises(MustNotBeUnknownRWError, lambda: n.raise_error())
+            self.failUnlessRaises(MustNotBeUnknownRWError, lambda n=n: n.raise_error())
 
         for (i, n) in must_be_ro:
-            self.failUnlessRaises(MustBeReadonlyError, lambda: n.raise_error())
+            self.failUnlessRaises(MustBeReadonlyError, lambda n=n: n.raise_error())
 
         for (i, n) in must_be_imm:
-            self.failUnlessRaises(MustBeDeepImmutableError, lambda: n.raise_error())
+            self.failUnlessRaises(MustBeDeepImmutableError, lambda n=n: n.raise_error())
 
         for (i, n) in bad_uri:
-            self.failUnlessRaises(uri.BadURIError, lambda: n.raise_error())
+            self.failUnlessRaises(uri.BadURIError, lambda n=n: n.raise_error())
 
         for (i, n) in ok:
             self.failIf(n.get_readonly_uri() is None, i)
index 30485b4a020da0ad8b0a23eeba5c2a9b296174fa..0e9f69439fa580d2f2c549f090a6763b2561ea45 100644 (file)
@@ -1115,7 +1115,7 @@ class Corruption(_Base, unittest.TestCase):
             for i,which,substring in corrupt_me:
                 # All these tests result in a failed download.
                 d.addCallback(self._corrupt_flip_all, imm_uri, i)
-                d.addCallback(lambda ign:
+                d.addCallback(lambda ign, which=which, substring=substring:
                               self.shouldFail(NoSharesError, which,
                                               substring,
                                               _download, imm_uri))