aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage/base.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2010-01-27 10:27:27 -0500
committerW. Trevor King <wking@drexel.edu>2010-01-27 10:27:27 -0500
commit4203368d2a1f9cc794646754a5027e307074fbf6 (patch)
tree213af04295ed8a604a050532e393f970e494f00a /libbe/storage/base.py
parent8a07fe257946104c80f656617c168a340f4dae77 (diff)
downloadbugseverywhere-4203368d2a1f9cc794646754a5027e307074fbf6.tar.gz
Make VCS error messages and Storage test failures more descriptive
Diffstat (limited to 'libbe/storage/base.py')
-rw-r--r--libbe/storage/base.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/libbe/storage/base.py b/libbe/storage/base.py
index 64ae3e7..423f141 100644
--- a/libbe/storage/base.py
+++ b/libbe/storage/base.py
@@ -552,20 +552,29 @@ if TESTING == True:
# 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 _classname(self):
+ version = '?'
+ try:
+ if hasattr(self, 's'):
+ version = self.s.version()
+ except:
+ pass
+ return '%s:%s' % (self.Class.__name__, version)
+
def fail(self, msg=None):
"""Fail immediately, with the given message."""
raise self.failureException, \
- '(%s) %s' % (self.Class.__name__, msg)
+ '(%s) %s' % (self._classname(), 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)
+ '(%s) %s' % (self.classname(), 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)
+ '(%s) %s' % (self.classname(), msg)
def setUp(self):
"""Set up test fixtures for Storage test case."""