mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
fix: count the profiles the named listing shows
This commit is contained in:
1 parent
41e33032f7
commit
7577ec4c18
2 files changed
+27
-1
No files matched your search
@@ -3304,9 +3304,15 @@ def select_profiles(profiles: dict, args: argparse.Namespace) -> dict:
|
||||
"""Profiles matching the selection flags."""
|
||||
if args.emulator:
|
||||
if args.emulator not in profiles:
|
||||
# Suggested from what the listing it names shows: counted over the
|
||||
# alias and test profiles too, "lists all 553" pointed at 530 lines.
|
||||
listed = sorted(
|
||||
name for name, profile in profiles.items()
|
||||
if profile.get("type") not in ("alias", "test")
|
||||
)
|
||||
raise SystemExit(
|
||||
f"ERROR: unknown profile {args.emulator}. "
|
||||
+ suggest_names([args.emulator], sorted(profiles), "verify.py --list-emulators")
|
||||
+ suggest_names([args.emulator], listed, "verify.py --list-emulators")
|
||||
)
|
||||
return {args.emulator: profiles[args.emulator]}
|
||||
|
||||
|
||||
@@ -4165,5 +4165,25 @@ class TestAnUnansweringRepository(unittest.TestCase):
|
||||
self.assertEqual(report.skipped, "upstream gone (declared): 404 since 2026-10-18")
|
||||
|
||||
|
||||
class TheUnknownProfileHintCountsTheListing(unittest.TestCase):
|
||||
"""profile_sync said "verify.py --list-emulators lists all 553" for a
|
||||
listing of 530: the alias and test profiles it counted are not listed."""
|
||||
|
||||
def test_the_count_matches(self):
|
||||
import subprocess # noqa: PLC0415
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
hint = subprocess.run(
|
||||
[sys.executable, "scripts/profile_sync.py", "--emulator", "no-such-profile"],
|
||||
cwd=root, capture_output=True, text=True, timeout=120, check=False,
|
||||
)
|
||||
listing = subprocess.run(
|
||||
[sys.executable, "scripts/verify.py", "--list-emulators"],
|
||||
cwd=root, capture_output=True, text=True, timeout=120, check=False,
|
||||
).stdout
|
||||
count = len([line for line in listing.splitlines() if line.strip()])
|
||||
self.assertIn(f"lists all {count}.", hint.stderr + hint.stdout)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user