From 99c8974ecf3748c68b7b01e64e76face8fead267 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 16 Oct 2026 11:42:28 +0200 Subject: [PATCH] fix: list verify platforms from --platforms-dir --- scripts/verify.py | 7 +++--- tests/test_verify_all_dir.py | 42 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 tests/test_verify_all_dir.py diff --git a/scripts/verify.py b/scripts/verify.py index c3a8f2bf..a447f007 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -39,6 +39,7 @@ from common import ( PROFILE_IDENTITY_FIELDS, list_available_targets, list_platform_system_ids, + list_registered_platforms, build_target_cores_cache, build_zip_contents_index, check_inside_zip, @@ -2021,9 +2022,9 @@ def main(): # Platform mode (existing) if args.all: - from list_platforms import list_platforms as _list_platforms - - platforms = _list_platforms(include_archived=args.include_archived) + platforms = list_registered_platforms( + args.platforms_dir, include_archived=args.include_archived + ) elif args.platform: platforms = [args.platform] else: diff --git a/tests/test_verify_all_dir.py b/tests/test_verify_all_dir.py new file mode 100644 index 00000000..6e007733 --- /dev/null +++ b/tests/test_verify_all_dir.py @@ -0,0 +1,42 @@ +"""``verify.py --all`` lists the platforms of ``--platforms-dir``. + +The list came from ``platforms/`` whatever the flag said, while each config +was read from the flag's directory: a platform absent from the copy crashed +the run, and one registered only in the copy was never checked. +""" + +from __future__ import annotations + +import json +import subprocess +import sys +import tempfile +import unittest +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parents[1] + + +class AllReadsTheGivenDirectory(unittest.TestCase): + def test_only_the_directory_platforms(self): + (REPO_ROOT / "tmp").mkdir(exist_ok=True) + with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as tmp: + plat = Path(tmp) + (plat / "_registry.yml").write_text( + "platforms:\n solo:\n config: solo.yml\n" + ) + (plat / "solo.yml").write_text( + "platform: Solo\nverification_mode: existence\n" + "base_destination: system\nsystems: {}\n" + ) + run = subprocess.run( + [sys.executable, "scripts/verify.py", "--all", + "--platforms-dir", str(plat), "--json"], + cwd=REPO_ROOT, capture_output=True, text=True, + ) + self.assertEqual(run.returncode, 0, run.stderr[-2000:]) + self.assertEqual(list(json.loads(run.stdout)), ["solo"]) + + +if __name__ == "__main__": + unittest.main()