Skip to content

feat(cli): tests that cannot fail correctly #421

Closed

Description

@dan-petty

Context & Rationale

Eight tests assert pytest.raises(Exception) and nine pass an unescaped regex to match=. tests/test_ai_cmd.py:264 passes if any exception is raised, including a TypeError introduced by an unrelated refactor — the test certifies without checking, and would keep passing through the very regression it exists to catch. tests/test_argo_crd.py:213 matches "missing 'metadata.name'" where . is a wildcard, so the assertion is weaker than it reads.

Scope & Deliverables

  • Context & Rationale*: Eight tests assert pytest.raises(Exception) and nine pass an unescaped regex to match=. tests/test_ai_cmd.py:264 passes if any exception is raised, including a TypeError introduced by an unrelated refactor — the test certifies without checking, and would keep passing through the very regression it exists to catch. tests/test_argo_crd.py:213 matches "missing 'metadata.name'" where . is a wildcard, so the assertion is weaker than it reads.
  • Deliverable*: Narrow every blind pytest.raises to the specific exception type the code contracts to raise, and make match= patterns raw or re.escaped. Enforce with B017 and RUF043 so the class cannot return.
  • Constraint*: A test narrowed to the wrong exception type is worse than a blind one, because it fails for a reason unrelated to the behaviour under test. Each narrowing needs the contract checked, not guessed from the current implementation.

Strategic Alignment

  • Milestone: v0.2.23 (Foundational Architectural Guardrails & Project Hygiene)
  • Roadmap Reference: docs/ROADMAP.md

Activity

  1. added this to the v0.2.23 milestone on Sep 22, 2026
  2. added
    type/feature
    scope/cli
    priority/p1-high
    on Sep 22, 2026
  3. dan-petty commented on Sep 23, 2026

    @dan-petty
    OwnerAuthor

    Closed by #450, merged into release/v0.2.23.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/clitype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions