@@ -172,14 +172,16 @@ def _do_base_tests(self, rwrepo):
172172
173173
174174 # reset both heads to the previous version, verify that to_latest_revision works
175- for repo in (csm .module (), sm .module ()):
175+ smods = (sm .module (), csm .module ())
176+ for repo in smods :
176177 repo .head .reset ('HEAD~1' , working_tree = 1 )
177178 # END for each repo to reset
178179
179180 sm .update (recursive = True , to_latest_revision = True )
180- for repo in ( sm . module (), csm . module ()) :
181+ for repo in smods :
181182 assert repo .head .commit == repo .head .ref .tracking_branch ().commit
182183 # END for each repo to check
184+ del (smods )
183185
184186 # if the head is detached, it still works ( but warns )
185187 smref = sm .module ().head .ref
@@ -356,8 +358,8 @@ def test_root_module(self, rwrepo):
356358 rm .config_writer ()
357359
358360 # deep traversal gitdb / async
359- rsms = list ( rm .traverse ())
360- assert len (rsms ) == 2 # gitdb and async, async being a child of gitdb
361+ rsmsp = [ sm . path for sm in rm .traverse ()]
362+ assert len (rsmsp ) == 2 # gitdb and async, async being a child of gitdb
361363
362364 # cannot set the parent commit as root module's path didn't exist
363365 self .failUnlessRaises (ValueError , rm .set_parent_commit , 'HEAD' )
@@ -406,9 +408,9 @@ def test_root_module(self, rwrepo):
406408 #================
407409 nsmn = "newsubmodule"
408410 nsmp = "submrepo"
409- async_url = to_native_path_linux (join_path_native (self .rorepo .working_tree_dir , rsms [0 ]. path , rsms [1 ]. path ))
411+ async_url = to_native_path_linux (join_path_native (self .rorepo .working_tree_dir , rsmsp [0 ], rsmsp [1 ]))
410412 nsm = Submodule .add (rwrepo , nsmn , nsmp , url = async_url )
411- csmadded = rwrepo .index .commit ("Added submodule" )
413+ csmadded = rwrepo .index .commit ("Added submodule" ). hexsha # make sure we don't keep the repo reference
412414 nsm .set_parent_commit (csmadded )
413415 assert nsm .module_exists ()
414416 # in our case, the module should not exist, which happens if we update a parent
@@ -439,7 +441,7 @@ def test_root_module(self, rwrepo):
439441 # to the first repository, this way we have a fast checkout, and a completely different
440442 # repository at the different url
441443 nsm .set_parent_commit (csmremoved )
442- nsmurl = to_native_path_linux (join_path_native (self .rorepo .working_tree_dir , rsms [0 ]. path ))
444+ nsmurl = to_native_path_linux (join_path_native (self .rorepo .working_tree_dir , rsmsp [0 ]))
443445 nsm .config_writer ().set_value ('url' , nsmurl )
444446 csmpathchange = rwrepo .index .commit ("changed url" )
445447 nsm .set_parent_commit (csmpathchange )
0 commit comments