@@ -335,8 +335,14 @@ def test_skip_existing_repos(
335
335
336
336
# Verify enhanced output for existing repos
337
337
assert "Found 1 existing repositories in configuration:" in caplog .text
338
- assert f" - { repo_name } ({ remote_url } ) at { str (scan_dir )} /{ repo_name } in { config_file } " in caplog .text
339
- assert "All found repositories already exist in the configuration. Nothing to do." in caplog .text
338
+ assert (
339
+ f" - { repo_name } ({ remote_url } ) at { scan_dir !s} /{ repo_name } "
340
+ f"in { config_file } " in caplog .text
341
+ )
342
+ assert (
343
+ "All found repositories already exist in the configuration. Nothing to do."
344
+ in caplog .text
345
+ )
340
346
341
347
def test_user_confirmation (
342
348
self ,
@@ -459,35 +465,31 @@ def test_detailed_existing_repos_output(
459
465
) -> None :
460
466
"""Test detailed output when multiple repositories already exist."""
461
467
caplog .set_level ("INFO" )
462
-
468
+
463
469
# Create scan directory with multiple repos
464
470
scan_dir = tmp_path / "existing_repos"
465
471
scan_dir .mkdir ()
466
-
472
+
467
473
# Create multiple repositories
468
474
repos_data = []
469
- for i , repo_name in enumerate (["repo1" , "repo2" , "repo3" ]):
475
+ for _i , repo_name in enumerate (["repo1" , "repo2" , "repo3" ]):
470
476
remote_path = create_git_remote_repo ()
471
477
remote_url = f"file://{ remote_path } "
472
478
local_repo_path = scan_dir / repo_name
473
-
479
+
474
480
subprocess .run (
475
481
["git" , "clone" , remote_url , str (local_repo_path )],
476
482
check = True ,
477
483
capture_output = True ,
478
484
env = git_commit_envvars ,
479
485
)
480
486
repos_data .append ((repo_name , remote_url ))
481
-
487
+
482
488
# Pre-create config with all repos
483
489
config_file = tmp_path / ".vcspull.yaml"
484
- config_data = {
485
- str (scan_dir ) + "/" : {
486
- repo_name : remote_url for repo_name , remote_url in repos_data
487
- }
488
- }
490
+ config_data = {str (scan_dir ) + "/" : dict (repos_data )}
489
491
save_config_yaml (config_file , config_data )
490
-
492
+
491
493
# Run add_from_filesystem
492
494
add_from_filesystem (
493
495
scan_dir_str = str (scan_dir ),
@@ -496,17 +498,23 @@ def test_detailed_existing_repos_output(
496
498
base_dir_key_arg = None ,
497
499
yes = True ,
498
500
)
499
-
501
+
500
502
# Verify detailed output
501
503
assert "Found 3 existing repositories in configuration:" in caplog .text
502
-
504
+
503
505
# Check each repository is listed with correct details
504
506
for repo_name , remote_url in repos_data :
505
- expected_line = f" - { repo_name } ({ remote_url } ) at { str (scan_dir )} /{ repo_name } in { config_file } "
507
+ expected_line = (
508
+ f" - { repo_name } ({ remote_url } ) at { scan_dir !s} /{ repo_name } "
509
+ f"in { config_file } "
510
+ )
506
511
assert expected_line in caplog .text
507
-
512
+
508
513
# Verify final message
509
- assert "All found repositories already exist in the configuration. Nothing to do." in caplog .text
514
+ assert (
515
+ "All found repositories already exist in the configuration. Nothing to do."
516
+ in caplog .text
517
+ )
510
518
511
519
def test_mixed_existing_and_new_repos (
512
520
self ,
@@ -517,52 +525,48 @@ def test_mixed_existing_and_new_repos(
517
525
) -> None :
518
526
"""Test output when some repos exist and some are new."""
519
527
caplog .set_level ("INFO" )
520
-
528
+
521
529
# Create scan directory
522
530
scan_dir = tmp_path / "mixed_repos"
523
531
scan_dir .mkdir ()
524
-
532
+
525
533
# Create repositories
526
534
existing_repo_data = []
527
535
new_repo_data = []
528
-
536
+
529
537
# Create two existing repos
530
- for i , repo_name in enumerate (["existing1" , "existing2" ]):
538
+ for _i , repo_name in enumerate (["existing1" , "existing2" ]):
531
539
remote_path = create_git_remote_repo ()
532
540
remote_url = f"file://{ remote_path } "
533
541
local_repo_path = scan_dir / repo_name
534
-
542
+
535
543
subprocess .run (
536
544
["git" , "clone" , remote_url , str (local_repo_path )],
537
545
check = True ,
538
546
capture_output = True ,
539
547
env = git_commit_envvars ,
540
548
)
541
549
existing_repo_data .append ((repo_name , remote_url ))
542
-
550
+
543
551
# Create two new repos
544
- for i , repo_name in enumerate (["new1" , "new2" ]):
552
+ for _i , repo_name in enumerate (["new1" , "new2" ]):
545
553
remote_path = create_git_remote_repo ()
546
554
remote_url = f"file://{ remote_path } "
547
555
local_repo_path = scan_dir / repo_name
548
-
556
+
549
557
subprocess .run (
550
558
["git" , "clone" , remote_url , str (local_repo_path )],
551
559
check = True ,
552
560
capture_output = True ,
553
561
env = git_commit_envvars ,
554
562
)
555
563
new_repo_data .append ((repo_name , remote_url ))
556
-
564
+
557
565
# Pre-create config with only existing repos
558
566
config_file = tmp_path / ".vcspull.yaml"
559
- config_data = {
560
- str (scan_dir ) + "/" : {
561
- repo_name : remote_url for repo_name , remote_url in existing_repo_data
562
- }
563
- }
567
+ config_data = {str (scan_dir ) + "/" : dict (existing_repo_data )}
564
568
save_config_yaml (config_file , config_data )
565
-
569
+
566
570
# Run add_from_filesystem
567
571
add_from_filesystem (
568
572
scan_dir_str = str (scan_dir ),
@@ -571,15 +575,18 @@ def test_mixed_existing_and_new_repos(
571
575
base_dir_key_arg = None ,
572
576
yes = True ,
573
577
)
574
-
578
+
575
579
# Verify existing repos are listed
576
580
assert "Found 2 existing repositories in configuration:" in caplog .text
577
581
for repo_name , remote_url in existing_repo_data :
578
- expected_line = f" - { repo_name } ({ remote_url } ) at { str (scan_dir )} /{ repo_name } in { config_file } "
582
+ expected_line = (
583
+ f" - { repo_name } ({ remote_url } ) at { scan_dir !s} /{ repo_name } "
584
+ f"in { config_file } "
585
+ )
579
586
assert expected_line in caplog .text
580
-
587
+
581
588
# Verify new repos are added
582
589
for repo_name , remote_url in new_repo_data :
583
590
assert f"Adding '{ repo_name } ' ({ remote_url } )" in caplog .text
584
-
591
+
585
592
assert "Successfully updated" in caplog .text
0 commit comments