oct
Loading...
Searching...
No Matches
oct.testing.manifest Namespace Reference

Classes

class  PackageTestConfig
class  TestManifest

Functions

TestManifest load_test_manifest (Path root)
str _parse_default_profile (dict data)
list[PackageTestConfig] _parse_packages (dict data, Workspace workspace, str default_profile)
PackageTestConfig _parse_block (int idx, Subproject subproject, object block, str default_profile)
int _parse_max_workers (str where, dict block)
tuple[str,...] _parse_test_roots (str where, Subproject subproject, dict block, bool enabled)

Variables

tuple TEST_PROFILES = ("strict", "smoke", "full")
str DEFAULT_TEST_PROFILE = "strict"
int DEFAULT_MAX_WORKERS = 24

Detailed Description

Purpose
-------
Parse + validate the spec-10 §9 workspace-manifest ``test`` blocks
(Plan 189). The shipping v0.25 base loader
(``oct.core.workspace.load_workspace``) owns the base schema and
deliberately ignores unknown keys; this module layers the §9 test
configuration on top by re-reading the raw manifest for the additive
keys (``subprojects[].test``, top-level ``default_test_profile``)
without touching the base loader.

Responsibilities
----------------
- :func:`load_test_manifest` - load the base workspace via the v0.25
  loader, then parse/validate the test blocks into a
  :class:`TestManifest` of :class:`PackageTestConfig` entries.
- Own the Plan-239 P1 ``max_workers`` key: the per-package cap on test
  workers, validated as a positive int, defaulted to
  :data:`DEFAULT_MAX_WORKERS`. Both the pytest side
  (``oct.testing.parallel``) and the §20 stand-in read this one key.
- Map every invalid-manifest condition to the §12.4 taxonomy as data
  (:class:`oct.testing.errors.OctTestError`): a base-loader rejection
  is the documented ``9101``; a test-config content violation is the
  documented ``9102``; a missing manifest is
  ``WORKSPACE_FILE_NOT_FOUND``. NO ``sys.exit`` here - exits are
  mapped by the future CLI slice.
- Pin the TEST profile vocabulary (``strict``/``smoke``/``full``) -
  distinct from the LINT profiles (``proto``/``compact``/``strict``)
  that live in ``subprojects[].profile`` (the §9 vocabulary hazard).

Diagnostics
-----------
Domain: OCT-TESTING
Levels:
    L2: lifecycle (load start / end)
    L3: semantic details (per-package parse results)
    L4: deep tracing

Contracts
---------
- ``oct.core.workspace`` is a READ-ONLY dependency: base-schema
  semantics are exactly the v0.25 loader's, witnessed by
  ``tests/tests_testing/test_loader_tolerance_witness.py``.
- ``test_roots`` are SUBPROJECT-ROOT-RELATIVE (§9): absolute entries
  and entries escaping the subproject root are configuration errors.
- An ENABLED test block must declare non-empty ``test_roots`` -
  in workspace mode the manifest roots are authoritative (ADR-T-18),
  so an enabled package without roots is a misdeclaration.
- Existence of declared roots is NOT checked here: stale/empty roots
  are collection-time findings (§10 / §12.4 ``EMPTY_TEST_ROOT`` /
  ``UNDECLARED_TEST_ROOT``), owned by the future collection slice.
- ``max_workers`` refuses rather than degrades: a non-positive or
  non-integer value raises ``9102``, because a silently-defaulted cap
  is exactly the kind of configuration drift a run cannot detect.

Dependencies
------------
- oct.core.workspace (read-only: base schema + resolved paths)
- oct.core.diagnostics (_dbg)
- oct.testing.errors (the §12.4 taxonomy as data)

Function Documentation

◆ _parse_block()

PackageTestConfig oct.testing.manifest._parse_block ( int idx,
Subproject subproject,
object block,
str default_profile )
protected
Validate one ``subprojects[idx].test`` block (§9).

Definition at line 290 of file manifest.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parse_default_profile()

str oct.testing.manifest._parse_default_profile ( dict data)
protected
Validate the top-level ``default_test_profile`` key.

Definition at line 237 of file manifest.py.

Here is the caller graph for this function:

◆ _parse_max_workers()

int oct.testing.manifest._parse_max_workers ( str where,
dict block )
protected
Validate ``max_workers`` (Plan 239 P1): a positive int.

An absent key takes :data:`DEFAULT_MAX_WORKERS`. A non-positive
or non-integer value is a configuration error, not a silent
degrade: a cap of 0 or -1 would otherwise read as "no limit" at
one call site and "serial" at another. ``True``/``False`` are
ints in Python and are refused explicitly.

Definition at line 338 of file manifest.py.

Here is the caller graph for this function:

◆ _parse_packages()

list[PackageTestConfig] oct.testing.manifest._parse_packages ( dict data,
Workspace workspace,
str default_profile )
protected
Build one :class:`PackageTestConfig` per subproject entry.

Definition at line 252 of file manifest.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parse_test_roots()

tuple[str, ...] oct.testing.manifest._parse_test_roots ( str where,
Subproject subproject,
dict block,
bool enabled )
protected
Validate ``test_roots``: relative, inside the subproject root.

An ENABLED block must declare at least one root (ADR-T-18 makes
the declared roots authoritative in workspace mode); a disabled
block may omit the key entirely.

Definition at line 359 of file manifest.py.

Here is the caller graph for this function:

◆ load_test_manifest()

TestManifest oct.testing.manifest.load_test_manifest ( Path root)
Load the workspace manifest at *root* with its §9 test view.

Parameters
----------
root
    Workspace root (the directory containing
    ``.option_c_workspace.json``).

Returns
-------
:class:`TestManifest`

Raises
------
OctTestError
    ``WORKSPACE_FILE_NOT_FOUND`` when no manifest exists at
    *root*; ``9101`` when the manifest exists but the v0.25 base
    loader rejects it; ``9102`` when the base schema is valid but
    the §9 test configuration is not.

Definition at line 170 of file manifest.py.

Here is the call graph for this function:

Variable Documentation

◆ DEFAULT_MAX_WORKERS

int oct.testing.manifest.DEFAULT_MAX_WORKERS = 24

Definition at line 99 of file manifest.py.

◆ DEFAULT_TEST_PROFILE

str oct.testing.manifest.DEFAULT_TEST_PROFILE = "strict"

Definition at line 94 of file manifest.py.

◆ TEST_PROFILES

tuple oct.testing.manifest.TEST_PROFILES = ("strict", "smoke", "full")

Definition at line 90 of file manifest.py.