@@ -193,41 +193,45 @@ 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+ for new , old in zip (new_refs , old_refs , strict = True ):
218+ assert new .name == old ['name' ]
219+ assert new .oid == old ['oid' ]
220+ assert new .loid == old ['loid' ]
221+ assert new .local == old ['local' ]
222+ assert new .symref_target == old ['symref_target' ]
219223
220224
221225@utils .requires_network
222- def test_ls_remotes_without_implicit_connect (testrepo : Repository ) -> None :
226+ def test_list_heads_without_implicit_connect (testrepo : Repository ) -> None :
223227 assert 1 == len (testrepo .remotes )
224228 remote = testrepo .remotes [0 ]
225229
226230 with pytest .raises (pygit2 .GitError , match = 'this remote has never connected' ):
227- remote .ls_remotes (connect = False )
231+ remote .list_heads (connect = False )
228232
229233 remote .connect ()
230- refs = remote .ls_remotes (connect = False )
234+ refs = remote .list_heads (connect = False )
231235 assert refs
232236
233237 # Check that a known ref is returned.
@@ -328,7 +332,7 @@ def update_tips(self, name: str, old: pygit2.Oid, new: pygit2.Oid) -> None:
328332
329333
330334@utils .requires_network
331- def test_ls_remotes_certificate_check () -> None :
335+ def test_list_heads_certificate_check () -> None :
332336 url = 'https://github.com/pygit2/empty.git'
333337
334338 class MyCallbacks (pygit2 .RemoteCallbacks ):
@@ -350,7 +354,7 @@ def certificate_check(
350354 remote = git .remotes .create_anonymous (url )
351355
352356 callbacks = MyCallbacks ()
353- refs = remote .ls_remotes (callbacks = callbacks )
357+ refs = remote .list_heads (callbacks = callbacks )
354358
355359 # Sanity check that we indeed got some refs.
356360 assert len (refs ) > 0
0 commit comments