Fix some potential bugs in test code exposed by check-miscaptures.py. refs #1556

This commit is contained in:
david-sarah 2011-10-06 19:34:43 -07:00
parent 11ce612589
commit bdfa7b3772
3 changed files with 7 additions and 7 deletions

View File

@ -757,9 +757,9 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
self.failUnlessIn("cannot contain", stderr) self.failUnlessIn("cannot contain", stderr)
for invalid in ['foo:bar', 'foo bar', 'foobar::']: 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(_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) d.addCallback(_check_invalid)
def _test_urls(junk): def _test_urls(junk):

View File

@ -1710,16 +1710,16 @@ class Dirnode2(testutil.ReallyEqualMixin, testutil.ShouldFailMixin, unittest.Tes
n.raise_error() n.raise_error()
for (i, n) in unknown_rw: 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: 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: 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: 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: for (i, n) in ok:
self.failIf(n.get_readonly_uri() is None, i) self.failIf(n.get_readonly_uri() is None, i)

View File

@ -1115,7 +1115,7 @@ class Corruption(_Base, unittest.TestCase):
for i,which,substring in corrupt_me: for i,which,substring in corrupt_me:
# All these tests result in a failed download. # All these tests result in a failed download.
d.addCallback(self._corrupt_flip_all, imm_uri, i) 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, self.shouldFail(NoSharesError, which,
substring, substring,
_download, imm_uri)) _download, imm_uri))