feat: generate features from source via [tool.testmap.generate]#17
Merged
Conversation
Lets [tool.testmap] declare features via __features__ = [...] that each default to the global required kinds, instead of repeating them in a [tool.testmap.features] table. Explicit table entries still override. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nt2UtcTGK75D11cSKzyTP4
Derive the expected feature universe statically so a feature with zero tests surfaces as an all-missing row instead of being invisible. Each [[tool.testmap.generate]] block is a select/from/where query: select functions or classes, glob source files, filter by public/private visibility. Resolved at load_config time and seeded into the matrix, so both the CLI and the pytest plugin pick it up with no call-site changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nt2UtcTGK75D11cSKzyTP4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
[[tool.testmap.generate]], which derives the expected feature universe statically from source. A feature with zero tests previously didn't exist in testmap's model — it only appeared once a test tagged it. Now generated features surface as all-missing rows, closing that blind spot.Each block is a small
select/from/wherequery:load_configtime and seeded into the matrix, so both the CLI and the pytest plugin get it with no call-site changes.astalready used bydiscover.py.Known tradeoff
Feature names are symbol-derived, so renaming a symbol silently orphans its tests. Inherent to any glob/query-based derivation; the refactor-safe fix is an in-source
@featuredecorator, left for a follow-up.Testing
make lint,make test(33 passed),make prek(incl. testmap self-check) all green. New tests cover kind/visibility selection, recursive globbing + dedupe, unknown-selectrejection, and end-to-end config generation. README documented with a worked example.🤖 Generated with Claude Code