refactor: derive the milestone bounds from the registry

The highest supported milestone was spelled out in six places across four
files: range(1, 7) and default="m6" in test_cli.py, the same pair in
test_milestones_dosboxx.py, and through=6 in both registry.py and suite.py.
Registering M7 meant finding all six, and missing one failed silently.

Derive MAX_MILESTONE and MILESTONES from CASES instead, and move the mN
selector parser to registry.milestone_number so the pytest module stops
carrying its own copy. Adding cases for a new milestone is now enough for
ferro-test to accept --through/--only for it.

No behaviour change: MAX_MILESTONE evaluates to 6, ferro-test still advertises
{m1..m6} with default m6, and the case snapshot is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BScg8CF1sAAM2zVHAu5zvW
This commit is contained in:
2026-08-16 22:11:36 +09:00
co-authored by Claude Opus 5
parent c25312135d
commit 4ad3e3097b
3 changed files with 23 additions and 19 deletions
+3 -13
View File
@@ -6,23 +6,13 @@ import warnings
import pytest
from ferrolang_vm.dosboxx import SuiteRun, run_suite
from ferrolang_vm.registry import all_cases
from ferrolang_vm.registry import MAX_MILESTONE, all_cases, milestone_number
from ferrolang_vm.suite import Case
def _number(name: str) -> int:
if not name.startswith("m") or not name[1:].isdigit():
raise ValueError(f"invalid milestone: {name}")
value = int(name[1:])
if value not in range(1, 7):
raise ValueError(f"unsupported milestone: {name}")
return value
ONLY = os.environ.get("FERRO_TEST_ONLY")
CASES = all_cases(
through=_number(os.environ.get("FERRO_TEST_THROUGH", "m6")),
only=_number(ONLY) if ONLY else None,
through=milestone_number(os.environ.get("FERRO_TEST_THROUGH", f"m{MAX_MILESTONE}")),
only=milestone_number(ONLY) if ONLY else None,
)