Repository navigation
test: read the instance library from a small library kept with the tests - #190
Merged
ehennestad merged 3 commits intoSep 11, 2026
Conversation
ehennestad
added this pull request to stack #189
September 11, 2026 06:22
Contributor
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## report-unresolved-controlled-instances #190 +/- ##
==========================================================================
+ Coverage 80.19% 80.67% +0.47%
==========================================================================
Files 423 423
Lines 4387 4387
==========================================================================
+ Hits 3518 3539 +21
+ Misses 869 848 -21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ehennestad
force-pushed
the
instance-library-test-fixture
branch
from
September 11, 2026 07:06
b4ff6bf to
18db58a
Compare
ehennestad
force-pushed
the
instance-library-test-fixture
branch
from
September 11, 2026 08:19
18db58a to
4fc3c3d
Compare
ehennestad
force-pushed
the
instance-library-test-fixture
branch
from
September 11, 2026 10:28
4fc3c3d to
0bc46cd
Compare
The instance library's tests read the library the toolbox downloads, so they depended on a network, on seventy megabytes arriving intact, and on whatever upstream held on the day. Their assumptions turned a missing or incomplete download into a silent skip, and cases that needed a library in a known state, a damaged document, an empty version folder, a folder that is not a library, could only be checked by hand. A small library now lives with the tests: six real instance documents chosen to cover the layouts the class has to read, one type per folder under terminologies, the plural folder names of licenses and content types, and an atlas subfolder of parcellation entities. Every type in it exists in every model version from v3.0 on. ommtest.helper.InstanceLibraryFixture copies that library into a temporary folder and makes it the library in use, so a test reads known instances and may change its copy. Afterwards the library in use is deleted, not read again from the default location, so a suite that never needs the downloaded library never downloads it. InstanceLibraryTest reads the small library, with precise expectations and the cases that were checked by hand now checked here. What only the downloaded library can answer, that every instance upstream ships resolves to a type and that the library follows the model version across the versions upstream publishes, moves to InstanceLibraryIntegrationTest and keeps its assumption. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ehennestad
force-pushed
the
instance-library-test-fixture
branch
from
September 11, 2026 12:01
0bc46cd to
66dcf6b
Compare
The tests moved here kept the comments they had before the comments on the branch below were rewritten. They now state the mechanism first and what is asserted second, in the same wording as the unit tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Stacked on #188. Test infrastructure for the instance library, and no change to the toolbox.
Why
InstanceLibraryTestread the library the toolbox downloads, so it depended on a network, on seventy megabytes arriving intact, and on whatever upstream held on the day. ItsassumeNotEmptyguards turned a missing or incomplete download into a silent skip, which is what CI was doing for two of its tests earlier in this stack. And the cases that need the library in a known state, a damaged document, an empty version folder, a folder that is not a library at all, could only be checked by hand, and were.getSingleton(folderPath)existed for a caller with a clone of the instances repository somewhere else, and nothing in the toolbox called it. A test library is that caller.What
A small library kept with the tests, under
tools/tests/fixtures/instances/latest: six real instance documents, 24 KB, chosen to cover the layouts the class has to read. Two age categories and a biological sex, one type per folder underterminologies, so a folder that names a type is told apart from a subgroup. A license and a content type, under the plural folder names their IRIs also use, for the segment lookup. A parcellation entity in a subfolder of its atlas, for the subgroup. Every type exists in every model version from v3.0 on, so a pipeline bump cannot strand it.ommtest.helper.InstanceLibraryFixture, besideModelVersionFixtureand in its pattern. It copies the test library into a temporary folder and makes that the library in use, so a test reads known instances and may change its copy. Afterwards the library in use is deleted rather than read again from the default location, so a suite that never needs the downloaded library never downloads it; the next baregetSingleton()reads the default again. Each application makes its own copy.InstanceLibraryTestrewritten on the fixture. Expectations are now exact, a table of the six instances with their types and modules, rather than "no row is empty". The cases checked by hand earlier in the stack are tests: a document without a readable@typeis reported by name and left untyped while its neighbours are typed; an empty version folder reads as an empty library with its columns in place; a location that does not exist, and one that exists but holds no version folder, are rejected before the library in use is touched.InstanceLibraryIntegrationTestkeeps what only the downloaded library can answer: that every instance upstream ships today resolves to a type in the model, which is the regression check for the next upstream rename, and that the library follows the model version across the versions upstream publishes. It keeps its assumption.Notes
The fixture hands out the library as
fixture.Library. A baregetSingleton()means the library at the default location, and asking for it from inside a fixture-backed test replaces the fixture's library with the downloaded one; the fixture's help says so. Consumers such aslistControlledInstancesandparseInstanceIRIcall it bare, so the fixture serves tests of the class itself, not tests of those consumers.Locally,
.git/info/excludemay list*.jsonld; the fixture documents were added withgit add -fand are tracked like the other fixtures.🤖 Generated with Claude Code