summaryrefslogtreecommitdiff
path: root/test/testlib/helper.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-28 19:15:42 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-28 19:15:54 +0200
commit1fe889ea0cb2547584075dc1eb77f52c54b9a8c4 (patch)
treecd3685e0bd87441eab4888efbc4e14a232a65a7b /test/testlib/helper.py
parent47e3138ee978ce708a41f38a0d874376d7ae5c78 (diff)
downloadgitpython-1fe889ea0cb2547584075dc1eb77f52c54b9a8c4.tar.gz
All tests adjusted to work with the changed internal sha representation
Diffstat (limited to 'test/testlib/helper.py')
-rw-r--r--test/testlib/helper.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/testlib/helper.py b/test/testlib/helper.py
index 4399561c..0bfdfa69 100644
--- a/test/testlib/helper.py
+++ b/test/testlib/helper.py
@@ -74,10 +74,19 @@ def with_bare_rw_repo(func):
rw_repo = self.rorepo.clone(repo_dir, shared=True, bare=True)
prev_cwd = os.getcwd()
try:
- return func(self, rw_repo)
+ try:
+ return func(self, rw_repo)
+ except:
+ # assure we keep the repo for debugging
+ print >> sys.stderr, "Keeping bare repo after failure: %s" % repo_dir
+ repo_dir = None
+ raise
+ # END handle exceptions
finally:
rw_repo.git.clear_cache()
- shutil.rmtree(repo_dir, onerror=_rmtree_onerror)
+ if repo_dir is not None:
+ shutil.rmtree(repo_dir, onerror=_rmtree_onerror)
+ # END remove repo dir
# END cleanup
# END bare repo creator
bare_repo_creator.__name__ = func.__name__
@@ -99,7 +108,7 @@ def with_rw_repo(working_tree_ref):
repo_dir = tempfile.mktemp("non_bare_%s" % func.__name__)
rw_repo = self.rorepo.clone(repo_dir, shared=True, bare=False, n=True)
- rw_repo.head.commit = working_tree_ref
+ rw_repo.head.commit = rw_repo.commit(working_tree_ref)
rw_repo.head.reference.checkout()
prev_cwd = os.getcwd()