aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage
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
parent8a07fe257946104c80f656617c168a340f4dae77 (diff)
downloadbugseverywhere-4203368d2a1f9cc794646754a5027e307074fbf6.tar.gz
Make VCS error messages and Storage test failures more descriptive
Diffstat (limited to 'libbe/storage')
-rw-r--r--libbe/storage/base.py15
-rw-r--r--libbe/storage/vcs/arch.py9
-rw-r--r--libbe/storage/vcs/base.py2
-rw-r--r--libbe/storage/vcs/darcs.py6
-rw-r--r--libbe/storage/vcs/git.py2
5 files changed, 23 insertions, 11 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."""
diff --git a/libbe/storage/vcs/arch.py b/libbe/storage/vcs/arch.py
index 74ba371..bfccf59 100644
--- a/libbe/storage/vcs/arch.py
+++ b/libbe/storage/vcs/arch.py
@@ -72,7 +72,8 @@ class Arch(base.VCS):
def _vcs_version(self):
status,output,error = self._u_invoke_client('--version')
- return output
+ version = '\n'.join(output.splitlines()[:2])
+ return version
def _vcs_detect(self, path):
"""Detect whether a directory is revision-controlled using Arch"""
@@ -307,7 +308,8 @@ class Arch(base.VCS):
return base.VCS._vcs_get_file_contents(self, relpath)
def _vcs_path(self, id, revision):
- raise NotImplementedError
+ raise NotImplementedError(
+ 'Too little Arch understanding at the moment...')
def _vcs_commit(self, commitfile, allow_empty=False):
if allow_empty == False:
@@ -356,7 +358,8 @@ class Arch(base.VCS):
return '%s--%s' % (self._archive_project_name(), log)
def _vcs_changed(self, revision):
- raise NotImplementedError
+ raise NotImplementedError(
+ 'Too little Arch understanding at the moment...')
if libbe.TESTING == True:
diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py
index 8335cfa..337576e 100644
--- a/libbe/storage/vcs/base.py
+++ b/libbe/storage/vcs/base.py
@@ -515,7 +515,7 @@ os.listdir(self.get_path("bugs")):
"""
Does the path exist in a given revision? (True/False)
"""
- raise NotImplementedError
+ raise NotImplementedError('Lazy BE developers')
def _vcs_remove(self, path):
"""
diff --git a/libbe/storage/vcs/darcs.py b/libbe/storage/vcs/darcs.py
index c6892b4..7c6f069 100644
--- a/libbe/storage/vcs/darcs.py
+++ b/libbe/storage/vcs/darcs.py
@@ -53,7 +53,7 @@ class Darcs(base.VCS):
def _vcs_version(self):
status,output,error = self._u_invoke_client('--version')
- return output.rstrip('\n')
+ return output.strip()
def version_cmp(self, *args):
"""
@@ -191,8 +191,8 @@ class Darcs(base.VCS):
if path in children:
return True
return False
- # Darcs versions <= 2.3.1 lack the --patch option for 'show files'
- raise NotImplementedError
+ raise NotImplementedError(
+ 'Darcs versions <= 2.3.1 lack the --patch option for "show files"')
def _vcs_listdir(self, path, revision):
if self.version_cmp(2, 3, 1) == 1:
diff --git a/libbe/storage/vcs/git.py b/libbe/storage/vcs/git.py
index 6d3aa87..e2c1b83 100644
--- a/libbe/storage/vcs/git.py
+++ b/libbe/storage/vcs/git.py
@@ -49,7 +49,7 @@ class Git(base.VCS):
def _vcs_version(self):
status,output,error = self._u_invoke_client('--version')
- return output
+ return output.strip()
def _vcs_get_user_id(self):
status,output,error = \