From d90dd348365022dd5956059570da5aeb68fb75b6 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Jul 2026 18:49:30 +0000 Subject: [PATCH] fix: make CI actually run the test suite (collection import path + CLI regression) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI's `pytest -q` step was failing at collection with `ModuleNotFoundError: No module named 'scripts'`, which aborted the entire run — no tests executed on any PR or on main. Two root causes, both fixed: 1. pyproject `[tool.pytest.ini_options].pythonpath` listed `["src","scripts"]` but not the repo root, so `scripts` (a real package, scripts/__init__.py) was not importable as a top-level package by the 26 tests that do `import scripts.`. It only worked under `python -m pytest` (which adds CWD); CI uses the `pytest` console script, which does not. Add "." to pythonpath so the repo root is on sys.path under both invocations. 2. With collection fixed, 148 tests failed on a CLI NameError: `src/openamp_foundry/cli/main.py` built the `experiment-priority-check` subparser via `subparsers.add_parser(...)`, but the subparsers object is named `sub` (92 other call sites use `sub`; this was the lone `subparsers`). A regression from #832 that CI never caught because collection was already broken. One-identifier fix. Verified with the CI-equivalent invocation (`pytest -q`): the suite goes from 0 tests executed (collection abort) to 4418 passed. Four pre-existing failures remain (2 distinct bugs — candidate-summary-card lowercase validation and negative-result informativeness scoring); both fail on unmodified main, are unrelated to this change, were hidden by the broken collection, and need product-level review. Filed separately. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_0151yUvpHj6wAd6JraWyChEX --- pyproject.toml | 6 +++++- src/openamp_foundry/cli/main.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e489348a..78f96b74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,4 +41,8 @@ extend-exclude = [ [tool.pytest.ini_options] testpaths = ["tests"] -pythonpath = ["src", "scripts"] +# Repo root (".") must be on the path so tests can `import scripts.`: the +# scripts package (scripts/__init__.py) is imported as a top-level package by +# 26 test modules. Without ".", the console-script `pytest` used in CI cannot +# find it — only `python -m pytest`, which adds the CWD, worked, masking the gap. +pythonpath = ["src", "scripts", "."] diff --git a/src/openamp_foundry/cli/main.py b/src/openamp_foundry/cli/main.py index 1db13a82..aa194839 100644 --- a/src/openamp_foundry/cli/main.py +++ b/src/openamp_foundry/cli/main.py @@ -2286,7 +2286,7 @@ def build_parser() -> argparse.ArgumentParser: ) negative_result_parser.set_defaults(func=_run_negative_result_check) - experiment_priority_parser = subparsers.add_parser( + experiment_priority_parser = sub.add_parser( "experiment-priority-check", help="Validate an experiment priority justification entry", )