Skip to content

fix: make CI actually run the test suite (pytest collection import path + CLI subparser regression) - #841

Merged
cschanhniem merged 1 commit into
mainfrom
claude/improve-claude-agents-docs-aeajch
Jul 9, 2026
Merged

cschanhniem merged 1 commit into
mainfrom
claude/improve-claude-agents-docs-aeajch

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Description

CI's pytest -q step has been failing at collection with ModuleNotFoundError: No module named 'scripts', which aborts the entire run — no tests execute on any PR or on main. This has masked real regressions. Two root causes, both fixed here.

1. Test collection (pyproject). [tool.pytest.ini_options].pythonpath was ["src", "scripts"] but did not include the repo root. The scripts directory is a real package (scripts/__init__.py) that 26 test modules import as a top-level package (import scripts.<mod>). With only src and scripts on the path, import scripts is unresolvable. It happened to work under python -m pytest (which adds the CWD to sys.path) but not under the pytest console script that CI runs. Fix: add "." so the repo root is on the path under both invocations.

2. CLI subparser regression (src/openamp_foundry/cli/main.py). With collection fixed, 148 tests failed on NameError: name 'subparsers' is not defined from the CLI. The experiment-priority-check subparser was registered 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.

Change class

  • Class B — infrastructure / CLI change

Type of change

  • Bug fix
  • Infrastructure / CI / tooling

Safety impact

  • No biological misuse capability added
  • No harmful optimization objective added
  • No efficacy, safety, clinical, or therapeutic claims
  • No scoring, ranking, calibration, benchmark-threshold, or safety-policy behavior changed
  • Limitations documented (see below)

Verification

Run with the CI-equivalent invocation (pytest -q, console script) after pip install -e ".[dev]":

  • Before: collection aborts — 3 errors during collection, 0 tests executed.
  • After: 4418 passed, 8 skipped.
  • ruff check src/openamp_foundry/cli/main.py → clean.
  • The three originally-uncollectable benchmark modules now collect and pass (14 tests).

Limitations — pre-existing failures this unmasks

Fixing collection reveals 4 failing tests (2 distinct pre-existing bugs) that fail on unmodified main, are unrelated to this change, and were hidden by the broken collection. They are out of scope here because both require product-level judgment and one is an explicit Class-C stop condition (scoring). Filed as separate issues:

  1. tests/evidence/test_candidate_summary_card.py::test_lowercase_sequence_fails — the validator .upper()-normalizes before checking amino acids, so it accepts lowercase, but its own test demands rejection (and presynth_check.py also normalizes). Code-vs-test conflict needing a spec decision.
  2. tests/evidence/test_negative_result_informativeness.py::TestCLI (×3) — the informativeness scorer classifies its own test fixture below the INFORMATIVE threshold (≥6.0/7.0). Changing scoring behavior is a Class-C / human-review item.

This PR is deliberately the minimal, verified fix for the named bottleneck (CI cannot run the test suite) — one loop, one change. It is a strict improvement: from 0 tests executing to 4418 passing.

Agent disclosure

  • Fully or partly agent-generated and human-reviewed

Reviewer focus

  • Confirm adding "." to pythonpath is acceptable (repo root on sys.path; no test relies on the bare benchmarks. top-level — all 26 use scripts.).
  • The two pre-existing bugs above need owners; they are not addressed here on purpose.

🤖 Generated with Claude Code


Generated by Claude Code

…I regression)

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.<mod>`. 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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151yUvpHj6wAd6JraWyChEX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants