Option C Tools
Loading...
Searching...
No Matches
tests_diag.test_validate_config_strict Namespace Reference

Functions

Path _write_config (Path project_root, dict payload)
 _invoke (Path cwd, *str args)
 test_clean_config_exits_zero_in_both_modes (Path tmp_path)
 test_warning_only_config_passes_without_strict (Path tmp_path)
 test_warning_only_config_fails_with_strict (Path tmp_path)
 test_error_config_exits_one_without_strict (Path tmp_path)
 test_error_config_exits_two_with_strict (Path tmp_path)

Detailed Description

Purpose
-------
OI-534 / FS-513 — ``oct diag validate-config --strict`` promotes
WARNING-level issues to failures and returns exit code 2 so CI can
distinguish a strict-mode config audit failure from the generic exit 1
used by the non-strict path (reserved for ERROR-level schema problems).

The tests use a temporary ``oc_diagnostics/debug_config.json`` layout so
we never touch the real project config.

Responsibilities
----------------
- Verify non-strict mode: ERROR exits 1, WARNING exits 0.
- Verify strict mode: both ERROR and WARNING exit 2, clean exits 0.

Diagnostics
-----------
Domain: DIAG-TESTS
Levels:
    L2 — test lifecycle
    L3 — assertion details
    L4 — deep tracing

Contracts
---------
- Non-strict: ERROR → exit 1, WARNING → exit 0.
- Strict:     ERROR → exit 2, WARNING → exit 2, clean → exit 0.

Function Documentation

◆ _invoke()

tests_diag.test_validate_config_strict._invoke ( Path cwd,
*str args )
protected
Run ``oct diag validate-config ...`` with cwd pinned to ``cwd``.

Definition at line 64 of file test_validate_config_strict.py.

Here is the caller graph for this function:

◆ _write_config()

Path tests_diag.test_validate_config_strict._write_config ( Path project_root,
dict payload )
protected
Drop a debug_config.json at ``<root>/oc_diagnostics/`` and return it.

``find_project_root`` anchors on ``.octrc.json`` with ``root_marker``
set — use that rather than simulating the full ``docs/tests/...``
layout so the fixture stays lean.

Definition at line 47 of file test_validate_config_strict.py.

Here is the caller graph for this function:

◆ test_clean_config_exits_zero_in_both_modes()

tests_diag.test_validate_config_strict.test_clean_config_exits_zero_in_both_modes ( Path tmp_path)
OI-534: a fully-valid config exits 0 regardless of --strict.

Definition at line 75 of file test_validate_config_strict.py.

Here is the call graph for this function:

◆ test_error_config_exits_one_without_strict()

tests_diag.test_validate_config_strict.test_error_config_exits_one_without_strict ( Path tmp_path)
OI-534: non-strict ERROR → exit 1 (preserves legacy behaviour).

Definition at line 104 of file test_validate_config_strict.py.

Here is the call graph for this function:

◆ test_error_config_exits_two_with_strict()

tests_diag.test_validate_config_strict.test_error_config_exits_two_with_strict ( Path tmp_path)
OI-534: --strict upgrades ERROR exit from 1 to 2.

Definition at line 117 of file test_validate_config_strict.py.

Here is the call graph for this function:

◆ test_warning_only_config_fails_with_strict()

tests_diag.test_validate_config_strict.test_warning_only_config_fails_with_strict ( Path tmp_path)
OI-534: --strict promotes WARNING to exit 2.

Definition at line 96 of file test_validate_config_strict.py.

Here is the call graph for this function:

◆ test_warning_only_config_passes_without_strict()

tests_diag.test_validate_config_strict.test_warning_only_config_passes_without_strict ( Path tmp_path)
OI-534: WARNING issues alone exit 0 when --strict is absent.

Definition at line 87 of file test_validate_config_strict.py.

Here is the call graph for this function: