testutil.shouldFail: mention the 'which' string in substring failures too
authorBrian Warner <warner@allmydata.com>
Fri, 16 May 2008 23:08:38 +0000 (16:08 -0700)
committerBrian Warner <warner@allmydata.com>
Fri, 16 May 2008 23:08:38 +0000 (16:08 -0700)
src/allmydata/util/testutil.py

index d62d905b57155abea6dc6727fc2bfa035ef2f360..046d98e912a7f26224a93146f0ce74901feb519e 100644 (file)
@@ -74,8 +74,8 @@ class ShouldFailMixin:
                 res.trap(expected_failure)
                 if substring:
                     self.failUnless(substring in str(res),
-                                    "substring '%s' not in '%s'"
-                                    % (substring, str(res)))
+                                    "%s: substring '%s' not in '%s'"
+                                    % (which, substring, str(res)))
             else:
                 self.fail("%s was supposed to raise %s, not get '%s'" %
                           (which, expected_failure, res))