summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-11-04 20:09:19 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-11-04 20:12:22 +0100
commitec1f9c9e9a6ce14ddc69b6be65188b3438f31f23 (patch)
treecea4ab324046c27c9a6e3570f11425053846af2b
parentd884adc80c80300b4cc05321494713904ef1df2d (diff)
downloadgitpython-ec1f9c9e9a6ce14ddc69b6be65188b3438f31f23.tar.gz
helpers: fixed and improved test repo decorators to use the new head.checkout functions for greater ease of use - they work exactly as expected now.
Fixed failing test in remote tests by actually removing the line
-rw-r--r--test/git/test_refs.py4
-rw-r--r--test/git/test_remote.py4
-rw-r--r--test/testlib/helper.py8
3 files changed, 8 insertions, 8 deletions
diff --git a/test/git/test_refs.py b/test/git/test_refs.py
index 32a6de1c..8fa30aa1 100644
--- a/test/git/test_refs.py
+++ b/test/git/test_refs.py
@@ -223,10 +223,10 @@ class TestRefs(TestBase):
assert active_branch != rw_repo.active_branch
assert new_head == rw_repo.active_branch
- # checkout with force has we have a change
+ # checkout with force as we have a changed a file
# clear file
open(new_head.commit.tree.blobs[-1].abspath,'w').close()
- assert len(new_head.commit.diff(None)) == 1
+ assert len(new_head.commit.diff(None))
# create a new branch that is likely to touch the file we changed
far_away_head = rw_repo.create_head("far_head",'HEAD~100')
diff --git a/test/git/test_remote.py b/test/git/test_remote.py
index f049f6f7..0af9f0cf 100644
--- a/test/git/test_remote.py
+++ b/test/git/test_remote.py
@@ -316,10 +316,6 @@ class TestRemote(TestBase):
res = remote.push(all=True)
self._test_push_result(res, remote)
- # pull is essentially a fetch + merge, hence we just do a light
- # test here, leave the reset to the actual merge testing
- # fails as we did not specify a branch and there is no configuration for it
- self.failUnlessRaises(GitCommandError, remote.pull)
remote.pull('master')
# cleanup - delete created tags and branches as we are in an innerloop on
diff --git a/test/testlib/helper.py b/test/testlib/helper.py
index 081299be..4ab7207d 100644
--- a/test/testlib/helper.py
+++ b/test/testlib/helper.py
@@ -100,7 +100,10 @@ def with_rw_repo(working_tree_ref):
def repo_creator(self):
repo_dir = tempfile.mktemp("non_bare_repo")
rw_repo = self.rorepo.clone(repo_dir, shared=True, bare=False, n=True)
- rw_repo.git.checkout("-b", "master", working_tree_ref)
+
+ rw_repo.head.commit = working_tree_ref
+ rw_repo.head.reference.checkout()
+
try:
return func(self, rw_repo)
finally:
@@ -141,7 +144,8 @@ def with_rw_and_rw_remote_repo(working_tree_ref):
rw_remote_repo = self.rorepo.clone(remote_repo_dir, shared=True, bare=True)
rw_repo = rw_remote_repo.clone(repo_dir, shared=True, bare=False, n=True) # recursive alternates info ?
- rw_repo.git.checkout("-b", "master", working_tree_ref)
+ rw_repo.head.commit = working_tree_ref
+ rw_repo.head.reference.checkout()
# prepare for git-daemon
rw_remote_repo.daemon_export = True