fix: list verify platforms from --platforms-dir

This commit is contained in:
Abdessamad Derraz committed 2026-10-16 11:42:28 +02:00
1 parent b4cca4a6b2
commit 99c8974ecf
2 files changed
+46 -3

No files matched your search

+4 -3
View File
@@ -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:
+42
View File
@@ -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()