Skip to content

Chore(pre-commit): Remove the pytest hook #315

Closed

Description

Summary

This repository's .pre-commit-config.yaml runs the test suite as a
pytest hook. The hook was a stop-gap to stop local agent sessions
pushing code with failing tests. Tests now run in CI alone, which
already runs them on every pull request, so the hook goes from every
lfreleng-actions repository that has one (eight, each with its own
issue).

The ci.skip entry has to go as well. The organisation is moving
pre-commit execution from pre-commit.ci to the linting.yaml reusable
workflow in lfreleng-actions/generic-workflows, run from the
organisation .github repository through a ruleset. That workflow
fails any run whose ci.skip names a hook the configuration does not
define, rather than reporting a green check over a smaller selection
(see docs/linting.md there, Which hook stages a run reaches).

Findings

On the default branch as of 2026-11-22 (line numbers approximate):

  • .pre-commit-config.yaml (around line 157): a language: system pytest hook that runs the test suite on every commit.
  • ci.skip (around line 11): lists pytest, because pre-commit.ci cannot build the project environment.
  • CI already runs the tests on every pull request: .github/workflows/build-test.yaml, .github/workflows/advanced-tests.yaml, .github/workflows/compatibility.yaml.
  • The comment inside ci: (around lines 7-10) names pytest as a typing module basedpyright needs. That is about the basedpyright hook, not this one: leave it.
  • CONTRIBUTING.md and QUICKSTART.md may describe the hook; check them.

Required changes

  1. Delete the pytest hook from .pre-commit-config.yaml. It is the only hook in its repo: local entry, so remove that whole entry, together with any comment directly above it that describes running the tests.
  2. Remove pytest from ci.skip and keep every other entry in place, in order. A ci.skip that names a hook the configuration does not define fails the new organisation linting workflow, so this is required, not tidying.
  3. Leave pytest alone wherever it appears in a type checker's additional_dependencies (mypy, basedpyright): those make the test imports resolve for type checking and run no tests.
  4. Search the contributor documentation (README.md, AGENTS.md, CONTRIBUTING.md, docs/) for claims that tests run on commit or through pre-commit/prek, and update them to say tests run in CI and locally with uv run pytest.
  5. Change nothing under .github/workflows/, nothing in the test suite, and no pytest configuration in pyproject.toml. Do not add a linting workflow caller: the organisation-level one replaces it.

Acceptance criteria

  • No hook in .pre-commit-config.yaml runs pytest; prek list
    shows no pytest hook.
  • Every id under ci.skip names a hook the configuration defines.
  • prek run --all-files passes.
  • No contributor documentation says tests run on commit or through
    pre-commit/prek; it points at CI and uv run pytest.
  • The CI test workflows (.github/workflows/build-test.yaml, .github/workflows/advanced-tests.yaml, .github/workflows/compatibility.yaml) are unchanged and still run the
    tests.

Activity

  1. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent looked at this issue and did not attempt it: The fix requires editing the root .pre-commit-config.yaml (removing the pytest hook and its ci.skip entry), which is a protected file this workflow cannot publish changes to. A maintainer needs to make that edit by hand; contributor docs had no claims that tests run via pre-commit/prek.

  2. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent has proposed a change for this issue: pull request #316 (head 82a45ee). The Copilot review of it is clean. An antagonistic review was requested from the review bot.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions