Skip to content

Refactor: extract assertion helpers from tests/test_template.py into tests/test_support/contracts.py #35

@coderabbitai

Description

@coderabbitai

Background

Raised from PR #33 (#33).

Problem

tests/test_template.py currently exceeds 400 logical lines. The grouped assertion helper functions are defined inline in the top-level test file alongside test orchestration, making the file harder to navigate and maintain.

Task

Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate.

Specifically:

  1. Create a new module tests/test_support/contracts.py (with an appropriate tests/test_support/__init__.py if needed).
  2. Move the following helper functions—preserving their signatures and docstrings—into that new module:
    • assert_package_contracts
    • assert_makefile_contracts
    • assert_local_toolchain_contracts
    • assert_ci_contracts
    • assert_generated_documentation_contracts
    • assert_release_workflow_contracts
  3. Update tests/test_template.py to import those functions from tests.test_support.contracts and remove their definitions from this file.
  4. Ensure all call sites (e.g. inside test_generated_tooling_contracts and elsewhere) remain unchanged.
  5. Confirm the top-level test file falls below 400 logical lines after the refactor.
  6. Validate: run make test and confirm all tests pass.

Acceptance criteria

  • tests/test_support/contracts.py exists and contains the six helper functions with their original signatures and docstrings.
  • tests/test_template.py imports the helpers from the new module and is below 400 logical lines.
  • All existing test calls to the helpers are unmodified.
  • make test passes with no regressions.

Requested by @leynos.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions