Module fixtures

Module fixtures 

Source
Expand description

Catalogued-fixture resolution (tests/models/**).

Catalogued fixtures are not committed (tests/models/manifest.json), so a test that needs one skips when it is absent. A skip is invisible in cargo test output, which is issue #2802: a passing skip-shaped test looks the same as one that asserted something. IFC_LITE_REQUIRE_FIXTURES=1 (set by CI after pnpm fixtures) turns every skip into a panic.

fixture_bytes and fixture_text are the one decision point:

outcomegate offgate on (=1)
file presentSomeSome
NotFoundNone (skip)panic
Git LFS pointer (not fetched)None (skip)panic
any other I/O error / bad UTF-8panicpanic

The gate value is parsed strictly: only unset, "", "0" (off) and "1" (on) are accepted; anything else (true, yes, a typo) panics, because guessing “off” would recreate the silent-pass failure.

Enums§

FixtureError
Why a fixture could not be returned (the pure decision, see classify).

Functions§

classify
Classify a read result. Ok(Ok(bytes)) is a usable fixture, Ok(Err(_)) a skippable absence, and a hard I/O error panics.
fixture_bytes
Bytes of the catalogued fixture rel (relative to tests/models/), or None to skip. See the module table for the gate semantics.
fixture_path
Absolute path of the catalogued fixture rel (relative to tests/models/).
fixture_present
Whether the catalogued fixture rel is present, with the same gate semantics as fixture_bytes (absent or an LFS pointer: false, or a panic under the gate). Reads only the first bytes, so it is cheap for large models that the caller then loads itself.
fixture_text
fixture_bytes decoded as UTF-8 (invalid UTF-8 panics: a corrupt fixture is a setup error, not an absence).
local_fixture_text
Text of a PRIVATE, un-manifested local model under tests/models/ (one pnpm fixtures can never supply). Absent or an LFS pointer is always None – the gate deliberately does not apply, or the suite would fail CI unconditionally – while any other I/O error or bad UTF-8 still panics. Catalogued fixtures must use fixture_text instead.
repo_root
The repository root, derived from this crate’s location (rust/testkit).
require_fixtures
Parse IFC_LITE_REQUIRE_FIXTURES, failing closed on the config itself.
require_fixtures_from
The pure decision behind require_fixtures; a parameter so tests need not mutate the process environment (tests run on shared threads).
resolve_bytes
Decide the outcome for rel given an explicit gate value (testable core).