Option C Tools
Loading...
Searching...
No Matches
tests_git.test_quality_gate_sandbox Namespace Reference

Classes

class  _FakeCompleted

Functions

 test_run_test_pass_default_uses_subprocess (Path tmp_path, monkeypatch)
 test_run_test_pass_sandbox_uses_executor (Path tmp_path, monkeypatch)
 test_cli_check_accepts_sandbox_flag ()

Variables

 exit_code = code
bool timed_out = False

Detailed Description

Purpose
-------
OI-517 regression coverage — ``oct git check --sandbox`` must route the
optional pytest subprocess through :class:`oct.mcp.sandbox.SandboxExecutor`
so the sanitised environment rules (``PYTHONPATH`` stripped, secret-named
env vars stripped, output capped, 600s timeout) apply whenever tests are
included in the quality gate.

When ``--sandbox`` is absent, pytest must still run via the legacy
``subprocess.run`` path (unchanged behaviour for existing CI).

Responsibilities
----------------
- Verify ``sandbox=True`` routes pytest through ``SandboxExecutor``.
- Verify ``sandbox=False`` uses ``subprocess.run`` directly.
- Verify ``--sandbox`` CLI option threads through to ``run_quality_gate``.

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

Contracts
---------
- ``_run_test_pass(project_root, sandbox=True)`` goes through
  :class:`SandboxExecutor`.
- ``_run_test_pass(project_root)`` / ``sandbox=False`` uses
  ``subprocess.run`` directly.
- The CLI option ``--sandbox`` on ``oct git check`` threads through to
  :func:`run_quality_gate`.

Function Documentation

◆ test_cli_check_accepts_sandbox_flag()

tests_git.test_quality_gate_sandbox.test_cli_check_accepts_sandbox_flag ( )
OI-517: ``oct git check --sandbox --help`` parses; flag documented.

Definition at line 119 of file test_quality_gate_sandbox.py.

◆ test_run_test_pass_default_uses_subprocess()

tests_git.test_quality_gate_sandbox.test_run_test_pass_default_uses_subprocess ( Path tmp_path,
monkeypatch )
OI-517: no sandbox flag → legacy subprocess.run path.

Definition at line 60 of file test_quality_gate_sandbox.py.

◆ test_run_test_pass_sandbox_uses_executor()

tests_git.test_quality_gate_sandbox.test_run_test_pass_sandbox_uses_executor ( Path tmp_path,
monkeypatch )
OI-517: sandbox=True → SandboxExecutor.run replaces subprocess.run.

Definition at line 83 of file test_quality_gate_sandbox.py.

Variable Documentation

◆ exit_code

tests_git.test_quality_gate_sandbox.exit_code = code

Definition at line 95 of file test_quality_gate_sandbox.py.

◆ timed_out

bool tests_git.test_quality_gate_sandbox.timed_out = False

Definition at line 96 of file test_quality_gate_sandbox.py.