compare_fixture_versions#
- lsst.images.tests.compare_fixture_versions(old, current, *, path='', on_disk=<object object>)#
Compare an older fixture’s read against the current-version fixture.
- Parameters:
old (
object) – Canonical dump of the older fixture, read under current code.current (
object) – Canonical dump of the current-version fixture.path (
str, default:'') – Path prefix used in problem messages; callers leave this empty.on_disk (
object, default:<object object at 0x7ff0a570f7e0>) – The older fixture’s raw content as stored on disk, before model validation. Comparing a real fixture means passing the parsed file content here: this decides which paths the older file expressed, and reading it through a model materializes every field at its default, which would make later-born fields look present. The default ofolditself is correct only for a caller whoseoldnever went through validation, such as a test comparing literals.
- Returns:
One problem description per disagreement; empty when the older fixture projects cleanly onto the current one.
- Return type:
Notes
Both fixtures encode the same logical exemplar, which is allowed to grow as versions add fields. Whether a path counts as one the older file expresses is decided from
on_disk, not fromold: reading a fixture through a pydantic model materializes every field, including ones the file never mentioned, at its declared default, so deciding “later-born” fromolditself would treat every additive field as already present whenever its default happened to match, and would then reject any real, meaningful value chosen for it in the current exemplar.A path present in both
oldandcurrentand expressed byon_diskmust agree; a path incurrentthat is not expressed is a later-born field and is ignored; an expressed path missing fromcurrentis a failure, because the older file said something the current exemplar does not.Whether an unmatched path is expressed is narrow by design; see
_is_expressed. It recovers only a reshaped container whose exact path changed on disk, not any later-born field nested under an existing container, so a migration that renames or restructures a field beyond that one recovery is registered as expected divergence by its caller, and its migration test asserts the morphed result directly instead.