99Este script es un reemplazo completo y mejorado de test-install-mappings.sh
1010con 100% de paridad funcional:
1111
12- - ✓ Detección de secretos en modules/
13- - ✓ Verificación de todos los mappings del YAML
14- - ✓ Soporte para mappings múltiples y formato key|module
15- - ✓ Detección de archivos sanitizados con verificación CRLF
16- - ✓ Verificación de coherencia de directorios
17- - ✓ Prueba de portabilidad (ejecución desde diferentes directorios)
18- - ✓ Códigos de salida idénticos (0=OK, 1=error, 3=directorios, 4=secretos)
12+ - [OK] Detección de secretos en modules/
13+ - [OK] Verificación de todos los mappings del YAML
14+ - [OK] Soporte para mappings múltiples y formato key|module
15+ - [OK] Detección de archivos sanitizados con verificación CRLF
16+ - [OK] Verificación de coherencia de directorios
17+ - [OK] Prueba de portabilidad (ejecución desde diferentes directorios)
18+ - [OK] Códigos de salida idénticos (0=OK, 1=error, 3=directorios, 4=secretos)
1919
2020Ventajas sobre el bash:
2121- Usa yaml.safe_load() para parsing robusto del YAML
@@ -603,13 +603,13 @@ def test_subcommands(repo_root: Path) -> bool:
603603 timeout = 30
604604 )
605605 if result .returncode == 0 :
606- print (" ✓ inspect-mappings OK" )
606+ print (" [OK] inspect-mappings OK" )
607607 else :
608- print (f" ✗ inspect-mappings FALLÓ (exit { result .returncode } )" )
608+ print (f" [X] inspect-mappings FALLÓ (exit { result .returncode } )" )
609609 print (f" stderr: { result .stderr [:200 ]} " )
610610 errors += 1
611611 except Exception as e :
612- print (f" ✗ inspect-mappings ERROR: { e } " )
612+ print (f" [X] inspect-mappings ERROR: { e } " )
613613 errors += 1
614614
615615 # Test 2: backup-list (sin backups aún, pero no debe fallar)
@@ -623,12 +623,12 @@ def test_subcommands(repo_root: Path) -> bool:
623623 timeout = 10
624624 )
625625 if result .returncode == 0 :
626- print (" ✓ backup-list OK" )
626+ print (" [OK] backup-list OK" )
627627 else :
628- print (f" ✗ backup-list FALLÓ (exit { result .returncode } )" )
628+ print (f" [X] backup-list FALLÓ (exit { result .returncode } )" )
629629 errors += 1
630630 except Exception as e :
631- print (f" ✗ backup-list ERROR: { e } " )
631+ print (f" [X] backup-list ERROR: { e } " )
632632 errors += 1
633633
634634 # Test 3: backup-restore --latest --dry-run (debe fallar gracefully si no hay backups)
@@ -643,12 +643,12 @@ def test_subcommands(repo_root: Path) -> bool:
643643 )
644644 # Puede ser 0 (éxito) o 1 (no hay backups), ambos son válidos
645645 if result .returncode in [0 , 1 ]:
646- print (" ✓ backup-restore OK (comportamiento esperado)" )
646+ print (" [OK] backup-restore OK (comportamiento esperado)" )
647647 else :
648- print (f" ✗ backup-restore FALLÓ (exit { result .returncode } )" )
648+ print (f" [X] backup-restore FALLÓ (exit { result .returncode } )" )
649649 errors += 1
650650 except Exception as e :
651- print (f" ✗ backup-restore ERROR: { e } " )
651+ print (f" [X] backup-restore ERROR: { e } " )
652652 errors += 1
653653
654654 # Test 4: backup-clean 5 --dry-run
@@ -662,12 +662,12 @@ def test_subcommands(repo_root: Path) -> bool:
662662 timeout = 10
663663 )
664664 if result .returncode == 0 :
665- print (" ✓ backup-clean OK" )
665+ print (" [OK] backup-clean OK" )
666666 else :
667- print (f" ✗ backup-clean FALLÓ (exit { result .returncode } )" )
667+ print (f" [X] backup-clean FALLÓ (exit { result .returncode } )" )
668668 errors += 1
669669 except Exception as e :
670- print (f" ✗ backup-clean ERROR: { e } " )
670+ print (f" [X] backup-clean ERROR: { e } " )
671671 errors += 1
672672
673673 # Test 5: update-submodules (solo si hay distros/PKGBUILD/)
@@ -684,13 +684,13 @@ def test_subcommands(repo_root: Path) -> bool:
684684 timeout = 60
685685 )
686686 if result .returncode == 0 :
687- print (" ✓ update-submodules OK" )
687+ print (" [OK] update-submodules OK" )
688688 else :
689- print (f" ✗ update-submodules FALLÓ (exit { result .returncode } )" )
689+ print (f" [X] update-submodules FALLÓ (exit { result .returncode } )" )
690690 print (f" stderr: { result .stderr [:200 ]} " )
691691 errors += 1
692692 except Exception as e :
693- print (f" ✗ update-submodules ERROR: { e } " )
693+ print (f" [X] update-submodules ERROR: { e } " )
694694 errors += 1
695695 else :
696696 print (" ⊘ update-submodules SKIP (no hay distros/PKGBUILD/)" )
@@ -706,13 +706,13 @@ def test_subcommands(repo_root: Path) -> bool:
706706 timeout = 30
707707 )
708708 if result .returncode == 0 :
709- print (" ✓ setup-githooks OK" )
709+ print (" [OK] setup-githooks OK" )
710710 else :
711- print (f" ✗ setup-githooks FALLÓ (exit { result .returncode } )" )
711+ print (f" [X] setup-githooks FALLÓ (exit { result .returncode } )" )
712712 print (f" stderr: { result .stderr [:200 ]} " )
713713 errors += 1
714714 except Exception as e :
715- print (f" ✗ setup-githooks ERROR: { e } " )
715+ print (f" [X] setup-githooks ERROR: { e } " )
716716 errors += 1
717717
718718 # Test 7: setup-githooks --disable
@@ -726,22 +726,22 @@ def test_subcommands(repo_root: Path) -> bool:
726726 timeout = 10
727727 )
728728 if result .returncode == 0 :
729- print (" ✓ setup-githooks --disable OK" )
729+ print (" [OK] setup-githooks --disable OK" )
730730 else :
731- print (f" ✗ setup-githooks --disable FALLÓ (exit { result .returncode } )" )
731+ print (f" [X] setup-githooks --disable FALLÓ (exit { result .returncode } )" )
732732 errors += 1
733733 except Exception as e :
734- print (f" ✗ setup-githooks --disable ERROR: { e } " )
734+ print (f" [X] setup-githooks --disable ERROR: { e } " )
735735 errors += 1
736736
737737 # Resumen
738738 print ("\n " + "=" * 60 )
739739 if errors == 0 :
740- print ("✓ TODOS LOS SUBCOMANDOS FUNCIONAN CORRECTAMENTE" )
740+ print ("[OK] TODOS LOS SUBCOMANDOS FUNCIONAN CORRECTAMENTE" )
741741 print ("=" * 60 )
742742 return True
743743 else :
744- print (f"✗ { errors } SUBCOMANDO(S) FALLÓ/FALLARON" )
744+ print (f"[X] { errors } SUBCOMANDO(S) FALLÓ/FALLARON" )
745745 print ("=" * 60 )
746746 return False
747747
@@ -874,16 +874,16 @@ def scan_dir(current_dir: Path, depth: int):
874874 if warnings :
875875 print (f"\n Warnings: { len (warnings )} " )
876876 for w in warnings :
877- print (f" ⚠ { w } " )
877+ print (f" [!] { w } " )
878878
879879 if errors :
880880 print (f"\n Errores: { len (errors )} " )
881881 for e in errors :
882- print (f" ✗ { e } " )
882+ print (f" [X] { e } " )
883883 print ("\n " + "=" * 60 )
884884 return 1
885885 else :
886- print ("\n ✓ Todos los symlinks verificados correctamente" )
886+ print ("\n [OK] Todos los symlinks verificados correctamente" )
887887 print ("=" * 60 )
888888
889889 # Verificación adicional: probar que funciona desde diferentes directorios
@@ -894,11 +894,11 @@ def scan_dir(current_dir: Path, depth: int):
894894 # Test de subcomandos
895895 if not args .no_subcommands :
896896 if not test_subcommands (repo_root ):
897- print ("\n ✗ Algunos subcomandos no pasaron las pruebas" )
897+ print ("\n [X] Algunos subcomandos no pasaron las pruebas" )
898898 return 1
899899
900900 print ("\n " + "=" * 60 )
901- print ("✓ TODAS LAS VERIFICACIONES PASARON" )
901+ print ("[OK] TODAS LAS VERIFICACIONES PASARON" )
902902 print ("=" * 60 )
903903 return 0
904904
0 commit comments