@@ -193,41 +193,48 @@ def test_remote_list(testrepo: Repository) -> None:
193193
194194
195195@utils .requires_network
196- def test_ls_remotes (testrepo : Repository ) -> None :
196+ def test_list_heads (testrepo : Repository ) -> None :
197197 assert 1 == len (testrepo .remotes )
198198 remote = testrepo .remotes [0 ]
199199
200- refs = remote .ls_remotes ()
200+ refs = remote .list_heads ()
201201 assert refs
202202
203203 # Check that a known ref is returned.
204204 assert next (iter (r for r in refs if r .name == 'refs/tags/v0.28.2' ))
205205
206206
207207@utils .requires_network
208- def test_ls_remotes_backwards_compatibility (testrepo : Repository ) -> None :
208+ def test_ls_remotes_deprecated (testrepo : Repository ) -> None :
209209 assert 1 == len (testrepo .remotes )
210210 remote = testrepo .remotes [0 ]
211- refs = remote .ls_remotes ()
212- ref = refs [0 ]
213211
214- for field in ('name' , 'oid' , 'loid' , 'local' , 'symref_target' ):
215- new_value = getattr (ref , field )
216- with pytest .warns (DeprecationWarning , match = 'no longer returns a dict' ):
217- old_value = ref [field ]
218- assert new_value == old_value
212+ new_refs = remote .list_heads ()
213+
214+ with pytest .warns (DeprecationWarning , match = 'Use list_heads' ):
215+ old_refs = remote .ls_remotes ()
216+
217+ assert new_refs
218+ assert old_refs
219+
220+ for new , old in zip (new_refs , old_refs , strict = True ):
221+ assert new .name == old ['name' ]
222+ assert new .oid == old ['oid' ]
223+ assert new .loid == old ['loid' ]
224+ assert new .local == old ['local' ]
225+ assert new .symref_target == old ['symref_target' ]
219226
220227
221228@utils .requires_network
222- def test_ls_remotes_without_implicit_connect (testrepo : Repository ) -> None :
229+ def test_list_heads_without_implicit_connect (testrepo : Repository ) -> None :
223230 assert 1 == len (testrepo .remotes )
224231 remote = testrepo .remotes [0 ]
225232
226233 with pytest .raises (pygit2 .GitError , match = 'this remote has never connected' ):
227- remote .ls_remotes (connect = False )
234+ remote .list_heads (connect = False )
228235
229236 remote .connect ()
230- refs = remote .ls_remotes (connect = False )
237+ refs = remote .list_heads (connect = False )
231238 assert refs
232239
233240 # Check that a known ref is returned.
@@ -328,7 +335,7 @@ def update_tips(self, name: str, old: pygit2.Oid, new: pygit2.Oid) -> None:
328335
329336
330337@utils .requires_network
331- def test_ls_remotes_certificate_check () -> None :
338+ def test_list_heads_certificate_check () -> None :
332339 url = 'https://github.com/pygit2/empty.git'
333340
334341 class MyCallbacks (pygit2 .RemoteCallbacks ):
@@ -350,7 +357,7 @@ def certificate_check(
350357 remote = git .remotes .create_anonymous (url )
351358
352359 callbacks = MyCallbacks ()
353- refs = remote .ls_remotes (callbacks = callbacks )
360+ refs = remote .list_heads (callbacks = callbacks )
354361
355362 # Sanity check that we indeed got some refs.
356363 assert len (refs ) > 0
0 commit comments