@@ -193,41 +193,48 @@ def test_remote_list(testrepo: Repository) -> None:
193
193
194
194
195
195
@utils .requires_network
196
- def test_ls_remotes (testrepo : Repository ) -> None :
196
+ def test_list_heads (testrepo : Repository ) -> None :
197
197
assert 1 == len (testrepo .remotes )
198
198
remote = testrepo .remotes [0 ]
199
199
200
- refs = remote .ls_remotes ()
200
+ refs = remote .list_heads ()
201
201
assert refs
202
202
203
203
# Check that a known ref is returned.
204
204
assert next (iter (r for r in refs if r .name == 'refs/tags/v0.28.2' ))
205
205
206
206
207
207
@utils .requires_network
208
- def test_ls_remotes_backwards_compatibility (testrepo : Repository ) -> None :
208
+ def test_ls_remotes_deprecated (testrepo : Repository ) -> None :
209
209
assert 1 == len (testrepo .remotes )
210
210
remote = testrepo .remotes [0 ]
211
- refs = remote .ls_remotes ()
212
- ref = refs [0 ]
213
211
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' ]
219
226
220
227
221
228
@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 :
223
230
assert 1 == len (testrepo .remotes )
224
231
remote = testrepo .remotes [0 ]
225
232
226
233
with pytest .raises (pygit2 .GitError , match = 'this remote has never connected' ):
227
- remote .ls_remotes (connect = False )
234
+ remote .list_heads (connect = False )
228
235
229
236
remote .connect ()
230
- refs = remote .ls_remotes (connect = False )
237
+ refs = remote .list_heads (connect = False )
231
238
assert refs
232
239
233
240
# Check that a known ref is returned.
@@ -328,7 +335,7 @@ def update_tips(self, name: str, old: pygit2.Oid, new: pygit2.Oid) -> None:
328
335
329
336
330
337
@utils .requires_network
331
- def test_ls_remotes_certificate_check () -> None :
338
+ def test_list_heads_certificate_check () -> None :
332
339
url = 'https://github.com/pygit2/empty.git'
333
340
334
341
class MyCallbacks (pygit2 .RemoteCallbacks ):
@@ -350,7 +357,7 @@ def certificate_check(
350
357
remote = git .remotes .create_anonymous (url )
351
358
352
359
callbacks = MyCallbacks ()
353
- refs = remote .ls_remotes (callbacks = callbacks )
360
+ refs = remote .list_heads (callbacks = callbacks )
354
361
355
362
# Sanity check that we indeed got some refs.
356
363
assert len (refs ) > 0
0 commit comments