summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-20 22:01:45 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-20 22:01:45 +0100
commitbeccf1907dae129d95cee53ebe61cc8076792d07 (patch)
tree9732e22a0e677413ec269e8b53ff31aa5b347a25 /test
parentca3fdbe2232ceb2441dedbec1b685466af95e73b (diff)
downloadgitpython-beccf1907dae129d95cee53ebe61cc8076792d07.tar.gz
Tried to get rid of held references which could keep a filehandle open. In fact, it didn't work, and ... something else keeps them open. Its odd, its weird, its windows, and I give up on it for now
Diffstat (limited to 'test')
-rw-r--r--test/git/test_submodule.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/git/test_submodule.py b/test/git/test_submodule.py
index 7b774285..d922f32a 100644
--- a/test/git/test_submodule.py
+++ b/test/git/test_submodule.py
@@ -172,14 +172,16 @@ class TestSubmodule(TestBase):
# reset both heads to the previous version, verify that to_latest_revision works
- for repo in (csm.module(), sm.module()):
+ smods = (sm.module(), csm.module())
+ for repo in smods:
repo.head.reset('HEAD~1', working_tree=1)
# END for each repo to reset
sm.update(recursive=True, to_latest_revision=True)
- for repo in (sm.module(), csm.module()):
+ for repo in smods:
assert repo.head.commit == repo.head.ref.tracking_branch().commit
# END for each repo to check
+ del(smods)
# if the head is detached, it still works ( but warns )
smref = sm.module().head.ref
@@ -356,8 +358,8 @@ class TestSubmodule(TestBase):
rm.config_writer()
# deep traversal gitdb / async
- rsms = list(rm.traverse())
- assert len(rsms) == 2 # gitdb and async, async being a child of gitdb
+ rsmsp = [sm.path for sm in rm.traverse()]
+ assert len(rsmsp) == 2 # gitdb and async, async being a child of gitdb
# cannot set the parent commit as root module's path didn't exist
self.failUnlessRaises(ValueError, rm.set_parent_commit, 'HEAD')
@@ -406,9 +408,9 @@ class TestSubmodule(TestBase):
#================
nsmn = "newsubmodule"
nsmp = "submrepo"
- async_url = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, rsms[0].path, rsms[1].path))
+ async_url = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, rsmsp[0], rsmsp[1]))
nsm = Submodule.add(rwrepo, nsmn, nsmp, url=async_url)
- csmadded = rwrepo.index.commit("Added submodule")
+ csmadded = rwrepo.index.commit("Added submodule").hexsha # make sure we don't keep the repo reference
nsm.set_parent_commit(csmadded)
assert nsm.module_exists()
# in our case, the module should not exist, which happens if we update a parent
@@ -439,7 +441,7 @@ class TestSubmodule(TestBase):
# to the first repository, this way we have a fast checkout, and a completely different
# repository at the different url
nsm.set_parent_commit(csmremoved)
- nsmurl = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, rsms[0].path))
+ nsmurl = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, rsmsp[0]))
nsm.config_writer().set_value('url', nsmurl)
csmpathchange = rwrepo.index.commit("changed url")
nsm.set_parent_commit(csmpathchange)