aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2010-01-18 12:46:08 -0500
committerW. Trevor King <wking@drexel.edu>2010-01-18 12:46:08 -0500
commite06f1aa3f5db039fa8bf1f26412059fe99588a2b (patch)
tree6c61b1f595cfa365993062392b23a97c69559d2b /libbe
parent0fbf5228f40a93b6090f5bfc392d4fb58349ed04 (diff)
downloadbugseverywhere-e06f1aa3f5db039fa8bf1f26412059fe99588a2b.tar.gz
Add class name to StorageTestCase failure reporting
Diffstat (limited to 'libbe')
-rw-r--r--libbe/storage/base.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/libbe/storage/base.py b/libbe/storage/base.py
index 10649a8..202305b 100644
--- a/libbe/storage/base.py
+++ b/libbe/storage/base.py
@@ -533,6 +533,23 @@ if TESTING == True:
super(StorageTestCase, self).__init__(*args, **kwargs)
self.dirname = None
+ # this class will be the basis of tests for several classes,
+ # so make sure we print the name of the class we're dealing with.
+ def fail(self, msg=None):
+ """Fail immediately, with the given message."""
+ raise self.failureException, \
+ '(%s) %s' % (self.Class.__name__, msg)
+
+ def failIf(self, expr, msg=None):
+ "Fail the test if the expression is true."
+ if expr: raise self.failureException, \
+ '(%s) %s' % (self.Class.__name__, msg)
+
+ def failUnless(self, expr, msg=None):
+ """Fail the test unless the expression is true."""
+ if not expr: raise self.failureException, \
+ '(%s) %s' % (self.Class.__name__, msg)
+
def setUp(self):
"""Set up test fixtures for Storage test case."""
super(StorageTestCase, self).setUp()