flowsemantics.testing.conformance package

Submodules

flowsemantics.testing.conformance.fixtures module

Python implementations of the fixture vocabulary (spec/fixtures.md).

Each fixture name resolves to a factory that produces the host-language callable or value the conformance runner binds into a Flow pipeline.

Callable signatures used by the engine:
  • condition / guard : (input) -> bool

  • action : (input) -> value

  • then stage : (input, previous_output) -> value

  • catch handler : (input, exception) -> value

  • hook : (input, rule_id, value) -> None

  • cleanup : (FinallyContext) -> None (Phase 2.5)

Abstract error kinds (fixtures.md) map to concrete Python exceptions:

Kind.Timeout -> TimeoutError Kind.Cancelled -> asyncio.CancelledError Kind.ValueError-> ValueError Kind.Any -> FixtureAnyError (a plain Exception subclass)

exception flowsemantics.testing.conformance.fixtures.FixtureAnyError[source]

Bases: Exception

Concrete mapping for the abstract kind Kind.Any.

class flowsemantics.testing.conformance.fixtures.FixtureContext[source]

Bases: object

Per-vector resolution context shared by fixtures in one vector.

__init__() → None[source]

Create an empty per-vector fixture context.

flowsemantics.testing.conformance.fixtures.exception_for_kind(kind: str) → BaseException[source]

Instantiate the concrete exception for an abstract error kind.

flowsemantics.testing.conformance.fixtures.kind_of_exception(exc: BaseException) → str[source]

Reverse-map a concrete exception to its abstract kind.

flowsemantics.testing.conformance.fixtures.list_fixture_names() → list[str][source]

Return all known fixture names (for coverage and diagnostics).

flowsemantics.testing.conformance.fixtures.resolve_fixture(ref: dict[str, Any], ctx: FixtureContext | None = None) → Any[source]

Resolve a FixtureRef ({fixture, params}) to a callable or value.

Raises:
  • KeyError – unknown fixture name or missing required parameter.

  • ValueError – invalid parameter type or value.

flowsemantics.testing.conformance.runner module

FlowSemantics conformance runner (conformance/runner-protocol.md).

Discovers *.json vectors recursively, resolves fixtures, builds a Flow pipeline through the public API, executes it, and compares the observed FlowOutcome against the vector’s expected block.

Usage:

python -m flowsemantics.testing.conformance.runner –vectors <dir>

Exit code 0 iff every discovered vector passes.

class flowsemantics.testing.conformance.runner.VectorResult(vector_id: str, passed: bool, reason: str = '')[source]

Bases: object

Outcome of running one conformance vector.

vector_id: str
passed: bool
reason: str = ''
__init__(vector_id: str, passed: bool, reason: str = '') → None
flowsemantics.testing.conformance.runner.run_vector(path: Path) → VectorResult[source]

Run a single vector file. Never raises; returns PASS/FAIL result.

flowsemantics.testing.conformance.runner.discover_vectors(vectors_dir: Path) → list[Path][source]

Recursively discover *.json vector files (runner-protocol.md).

flowsemantics.testing.conformance.runner.main(argv: list[str] | None = None) → int[source]

CLI entry point. Returns 0 iff all discovered vectors pass.

Module contents

flowsemantics.testing.conformance - Language-agnostic conformance runner.

Layer: Tests Module: flowsemantics.testing.conformance Since: 0.1.0 Implements: conformance/runner-protocol.md, spec/fixtures.md,

spec/vector.schema.json

Depends on: flowsemantics (public API), stdlib only Used by: python -m flowsemantics.testing.conformance.runner See also: SPEC.md section 14.3, 14.4

Notes

  • This subpackage is exempt from the zero-third-party audit rule (ALLOWLISTED_SOURCE_DIRS includes “testing”), but it uses stdlib only anyway.

  • The runner executes vectors through the real public API. It never reaches into private modules.