Skip to content

feat: consolidate check-tests-structure hook into this repository - #5

Draft
leoschwarz wants to merge 2 commits into
mainfrom
feat/vendor-check-tests-structure
Draft

feat: consolidate check-tests-structure hook into this repository#5
leoschwarz wants to merge 2 commits into
mainfrom
feat/vendor-check-tests-structure

Conversation

@leoschwarz

Copy link
Copy Markdown
Member

check-tests-structure (tests tree must mirror sources tree) lived in a personal GitHub account, while depiction and bfabricPy depend on it. This moves the tool here and publishes it as a pre-commit hook so those projects can drop that dependency.

Key changes

  • .ci/check-tests-structure/ — the tool vendored from leoschwarz/check-tests-structure@1228f93 (incl. its unreleased allow_missing_* fix) as a standalone subproject with its own pyproject.toml, uv.lock and MIT license. Distribution renamed to fgcz-check-tests-structure; import package and console script names unchanged, so consumers are drop-in.
  • .pre-commit-hooks.yaml — the consumer-facing surface.
  • The hook runs on this repo in the pre-commit stage; the subproject's own tests run in the pre-push stage.
  • Root gates: Ruff lints/formats .ci/** under a relaxed rule set, deptry excludes it, Pyright and coverage already did.

Non-obvious bits

  • pre-commit's language: python installs the hook repo's root package, so a subdirectory tool normally cannot be consumed through the plain repo: form. additional_dependencies: ["./.ci/check-tests-structure"] resolves relative to the cloned hook repo, which is what makes it work.
  • The hook environment therefore also installs this repo's root package, which requires Python >= 3.12. docs/check-tests-structure.md carries a git+...#subdirectory= fallback for older hook environments.
  • Ported as-is, so sources_path/tests_path still resolve against the working directory rather than the declaring pyproject.toml; workspace members must be checked from their own directory.
  • Consumers pin rev:, so this needs a release tag after merge.

Verification

Both hook stages pass; the vendored suite (12 tests) passes; pre-commit try-repo passes on a matching tree and exits 1 with fuzzy suggestions on a missing/orphan test; the git+...#subdirectory= form was installed and run from a git URL.

Consumer repos are untouched — docs/check-tests-structure.md has the pre-commit and nox snippets.

🤖 Prepared with assistance from Claude Opus 5 via Claude Code.

Vendors the check-tests-structure tool from leoschwarz/check-tests-structure
into .ci/check-tests-structure/ as a self-contained MIT-licensed subproject and
publishes it through a root .pre-commit-hooks.yaml, so FGCZ projects can consume
the hook without depending on a personal account.

The subproject keeps its own pyproject.toml and uv.lock, and is excluded from
the strict Pyright, coverage, and deptry gates that apply to the reference
package. The hook runs on this repository in the pre-commit stage and the
subproject's tests run in the pre-push stage.
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.

1 participant