Skip to content

Give each source file exactly one test file - #76

Merged
drametwally merged 2 commits into
mainfrom
one-test-file-per-source
Sep 20, 2026
Merged

drametwally merged 2 commits into
mainfrom
one-test-file-per-source

Conversation

@drametwally

Copy link
Copy Markdown
Collaborator

Every source file with a dedicated test now has exactly one test file, and the merge of a pull
request is gated on the tests passing.

One test file per source

Five sources had their tests split across two files. The second becomes a @Nested group
inside the first:

Was Now a group inside
NearestNeighborSearchIndexExtraTest NearestNeighborSearchIndexTest
SignatureIndexOnSequencesTest SignatureIndexTest
TermIndexOnSequencesTest TermIndexTest
NamespaceConfigAccessorsTest merged outright into NamespaceConfigTest
MetaFilterAccessorsTest merged outright into MetaFilterTest

Nesting rather than merging matters for the first three: each pair defines its own DELTA,
config and other helpers, and a nested group keeps its own fixtures instead of forcing the
two sets to be reconciled.

662 tests pass, against 663 before. The one test lost is a MetaFilter case asserting exactly
what another case already asserted.

What keeps its own file, and why

These test a contract across implementations rather than one class, which is the exception the
structure allows:

  • SparseEndToEndTest, SparseHybridEndToEndTest, CrossStructureFloorTest are end to end.
  • IndexPairingMatrixTest and IndexEdgeCasesTest exercise every index type against the
    Index contract.
  • SparseComparatorTest and SequenceComparatorTest cover two comparators each, and several
    of their cases assert on both at once, so splitting them would cut those cases in half.
  • ShardedTermIndexTest covers sharding, which lives in BaseInvertedIndex rather than in a
    class of its own.
  • ErrorClassesTest covers six error classes in 38 lines.

Merging is now gated on the tests

main had no protection at all, so anything could be pushed straight to it. It now requires
test on ubuntu-latest and test on macos-latest to pass before a merge, and that applies to
administrators too. Force pushes and branch deletion are disabled. Branches are not required to
be up to date with main first, so a passing branch does not need rebasing every time main
moves; say if you want that too.

Five sources had their tests split across two files. The second file becomes a nested group in
the first, which keeps one test file per source without reconciling two sets of fixtures that
name the same helpers differently.

The accessor tests of MetaFilter and NamespaceConfig merge outright, since neither carried
fixtures. One MetaFilter test asserted what another already asserted and is dropped, which is
the one test the count falls by.
@drametwally
drametwally force-pushed the one-test-file-per-source branch from 8af2dd4 to 251e23f Compare September 20, 2026 23:28
The header justified the run on main by a branch merging on a pass from before it was rebased,
which protection no longer allows. Records what the gate is, and that the job name is a
required check, since renaming it blocks every pull request.
@drametwally
drametwally merged commit 615fe81 into main Sep 20, 2026
3 checks passed
@drametwally
drametwally deleted the one-test-file-per-source branch September 21, 2026 01:12
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