Option C Tools
Loading...
Searching...
No Matches
tests_health.test_venv_warning Namespace Reference

Functions

dict _minimal_report (*, bool venv_active)
str _render (dict report)
 test_banner_renders_when_venv_inactive ()
 test_banner_absent_when_venv_active ()
 test_banner_absent_in_json_output (pytest.CaptureFixture capsys)
 test_banner_copy_instructs_venv_creation ()

Variables

str _BANNER_TEXT = "WARNING: not running inside a virtual environment."

Detailed Description

Purpose
-------
FS-504 regression coverage — ``oct health`` must surface a prominent
top-of-report banner when the operator runs the dashboard from outside
a virtual environment. The banner is what upgrades "naked Python" from
an easily-missed per-section ``[WARN]`` into something the operator
cannot overlook before reading the rest of the report.

The banner uses ``!`` as the rule character (70 columns) and carries
the literal string "WARNING: not running inside a virtual environment.".

Diagnostics
-----------
Domain: HEALTH-TESTS
Levels:
    L2 — test lifecycle

Contracts
---------
- ``venv.active == False`` → banner rendered.
- ``venv.active == True``  → banner absent (per-section [OK] still there).
- Banner never appears in JSON output (machine-readable path unchanged).

Function Documentation

◆ _minimal_report()

dict tests_health.test_venv_warning._minimal_report ( * ,
bool venv_active )
protected
Smallest ``report`` dict that satisfies ``_print_terminal_report``.

Definition at line 44 of file test_venv_warning.py.

Here is the caller graph for this function:

◆ _render()

str tests_health.test_venv_warning._render ( dict report)
protected

Definition at line 77 of file test_venv_warning.py.

Here is the caller graph for this function:

◆ test_banner_absent_in_json_output()

tests_health.test_venv_warning.test_banner_absent_in_json_output ( pytest.CaptureFixture capsys)
FS-504: JSON output is machine-readable — never gains a banner.

Definition at line 103 of file test_venv_warning.py.

Here is the call graph for this function:

◆ test_banner_absent_when_venv_active()

tests_health.test_venv_warning.test_banner_absent_when_venv_active ( )
FS-504: active venv → no banner; [OK] status still visible.

Definition at line 95 of file test_venv_warning.py.

Here is the call graph for this function:

◆ test_banner_copy_instructs_venv_creation()

tests_health.test_venv_warning.test_banner_copy_instructs_venv_creation ( )
FS-504: banner body mentions the exact ``python -m venv .venv`` remedy.

Definition at line 112 of file test_venv_warning.py.

Here is the call graph for this function:

◆ test_banner_renders_when_venv_inactive()

tests_health.test_venv_warning.test_banner_renders_when_venv_inactive ( )
FS-504: banner appears once and lands above the per-section summary.

Definition at line 84 of file test_venv_warning.py.

Here is the call graph for this function:

Variable Documentation

◆ _BANNER_TEXT

str tests_health.test_venv_warning._BANNER_TEXT = "WARNING: not running inside a virtual environment."
protected

Definition at line 41 of file test_venv_warning.py.