@@ -313,11 +313,25 @@ def test_remotes(
313
313
},
314
314
},
315
315
lambda git_remote , ** kwargs : {
316
- "second_remote" : f"file://{ git_remote } " ,
316
+ "second_remote" : GitRemote (
317
+ ** {
318
+ "name" : "second_remote" ,
319
+ "fetch_url" : f"file://{ git_remote } " ,
320
+ "push_url" : f"file://{ git_remote } " ,
321
+ }
322
+ )
317
323
},
318
324
lambda git_remote , ** kwargs : {
319
- "origin" : f"file://{ git_remote } " ,
320
- "second_remote" : f"file://{ git_remote } " ,
325
+ "origin" : GitRemote (
326
+ name = "origin" ,
327
+ push_url = f"file://{ git_remote } " ,
328
+ fetch_url = f"file://{ git_remote } " ,
329
+ ),
330
+ "second_remote" : GitRemote (
331
+ name = "second_remote" ,
332
+ push_url = f"file://{ git_remote } " ,
333
+ fetch_url = f"file://{ git_remote } " ,
334
+ ),
321
335
},
322
336
],
323
337
[
@@ -327,13 +341,48 @@ def test_remotes(
327
341
"repo_dir" : repos_path / repo_name ,
328
342
"remotes" : {
329
343
"origin" : f"file://{ git_remote } " ,
344
+ # accepts short-hand form since it's inputted in the constructor
345
+ "second_remote" : f"file://{ git_remote } " ,
330
346
},
331
347
},
348
+ lambda git_remote , ** kwargs : {},
332
349
lambda git_remote , ** kwargs : {
333
- "origin" : "https://github.com/vcs-python/libvcs" ,
350
+ "origin" : GitRemote (
351
+ name = "origin" ,
352
+ push_url = f"file://{ git_remote } " ,
353
+ fetch_url = f"file://{ git_remote } " ,
354
+ ),
355
+ "second_remote" : GitRemote (
356
+ name = "second_remote" ,
357
+ push_url = f"file://{ git_remote } " ,
358
+ fetch_url = f"file://{ git_remote } " ,
359
+ ),
360
+ },
361
+ ],
362
+ [
363
+ GitRepo ,
364
+ lambda git_remote , repos_path , repo_name , ** kwargs : {
365
+ "url" : f"file://{ git_remote } " ,
366
+ "repo_dir" : repos_path / repo_name ,
367
+ "remotes" : {
368
+ "origin" : f"file://{ git_remote } " ,
369
+ },
370
+ },
371
+ lambda git_remote , ** kwargs : {
372
+ "origin" : GitRemote (
373
+ ** {
374
+ "name" : "second_remote" ,
375
+ "fetch_url" : "https://github.com/vcs-python/libvcs" ,
376
+ "push_url" : "https://github.com/vcs-python/libvcs" ,
377
+ }
378
+ )
334
379
},
335
380
lambda git_remote , ** kwargs : {
336
- "origin" : "https://github.com/vcs-python/libvcs" ,
381
+ "origin" : GitRemote (
382
+ name = "origin" ,
383
+ push_url = "https://github.com/vcs-python/libvcs" ,
384
+ fetch_url = "https://github.com/vcs-python/libvcs" ,
385
+ ),
337
386
},
338
387
],
339
388
],
@@ -353,17 +402,13 @@ def test_remotes_update_repo(
353
402
git_repo : GitRepo = constructor (** lazy_constructor_options (** locals ()))
354
403
git_repo .obtain ()
355
404
356
- git_repo ._remotes = lazy_remote_dict (** locals ())
405
+ git_repo ._remotes | = lazy_remote_dict (** locals ())
357
406
git_repo .update_repo (set_remotes = True )
358
407
359
408
expected = lazy_remote_expected (** locals ())
360
409
assert len (expected .keys ()) > 0
361
410
for expected_remote_name , expected_remote_url in expected .items ():
362
- assert (
363
- expected_remote_name ,
364
- expected_remote_url ,
365
- expected_remote_url ,
366
- ) == git_repo .remote (expected_remote_name )
411
+ assert expected_remote_url == git_repo .remote (expected_remote_name )
367
412
368
413
369
414
def test_git_get_url_and_rev_from_pip_url ():
0 commit comments