]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
test/common.py: in shouldFail and shouldHTTPError, when the raised exception does...
authordavid-sarah <david-sarah@jacaranda.org>
Tue, 11 Oct 2011 00:22:27 +0000 (17:22 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Tue, 11 Oct 2011 00:22:27 +0000 (17:22 -0700)
src/allmydata/test/common.py

index 42890d81412c12d9d233e52a1fce125307057fa5..5f37900391a0084fd1ccd0fdb3b87ac591eb6f2f 100644 (file)
@@ -1069,8 +1069,8 @@ class ShouldFailMixin:
                 if substring:
                     message = repr(res.value.args[0])
                     self.failUnless(substring in message,
-                                    "substring '%s' not in '%s'"
-                                    % (substring, message))
+                                    "%s: substring '%s' not in '%s'"
+                                    % (which, substring, message))
             else:
                 self.fail("%s was supposed to raise %s, not get '%s'" %
                           (which, expected_failure, res))
@@ -1103,17 +1103,17 @@ class WebErrorMixin:
         assert callable
         def _validate(f):
             if code is not None:
-                self.failUnlessEqual(f.value.status, str(code))
+                self.failUnlessEqual(f.value.status, str(code), which)
             if substring:
                 code_string = str(f)
                 self.failUnless(substring in code_string,
-                                "substring '%s' not in '%s'"
-                                % (substring, code_string))
+                                "%s: substring '%s' not in '%s'"
+                                % (which, substring, code_string))
             response_body = f.value.response
             if response_substring:
                 self.failUnless(response_substring in response_body,
-                                "response substring '%s' not in '%s'"
-                                % (response_substring, response_body))
+                                "%s: response substring '%s' not in '%s'"
+                                % (which, response_substring, response_body))
             return response_body
         d = defer.maybeDeferred(callable, *args, **kwargs)
         d.addBoth(self._shouldHTTPError, which, _validate)