|
Option C Tools
|
Classes | |
| class | TestExitCodes |
| class | TestSecretsOverride |
| class | TestProfileMatrix |
| class | TestScope |
| class | TestFix |
| class | TestProtectedBranch |
| class | TestAuditTrail |
| class | TestJsonSchema |
Functions | |
| subprocess.CompletedProcess | _run_check (Path root, *str extra_args) |
| dict | _run_check_json (Path root, *str extra_args) |
| _switch_to_feature_branch (Path root, str branch="feature/test") | |
| dict|None | _latest_audit_record (Path root) |
Purpose
-------
Integration tests for ``oct git check`` (Phase 4B / G-B3).
Validates all six exit codes, the profile matrix, ``--fix`` round-trip,
``--staged-only`` / ``--all`` scope, protected-branch override,
audit trail, and AI-Trace emission.
Responsibilities
----------------
- One test per exit code (0 through 5).
- "Secrets override" test: lint + secret → exit code 5, not 1.
- Profile matrix: ``proto``/``compact``/``strict`` × violation type.
- ``--fix`` auto-fix then re-verify.
- ``--fix`` cannot bypass secrets.
- Protected-branch override forces ``strict`` despite ``--profile proto``.
- Audit row written to ``logs/git-audit-*.jsonl`` after every run.
Diagnostics
-----------
Domain: GIT-TESTS
Levels:
L2 — test lifecycle
L3 — assertion details
L4 — deep tracing
Contracts
---------
- Every test uses ``temp_git_project`` (real git repo on branch ``main``
by default).
- Tests that need a non-protected branch create one explicitly.
|
protected |
Read the last JSONL record from the newest audit file.
Definition at line 76 of file test_git_check.py.
|
protected |
Run ``oct git check`` in a subprocess and return the result.
Definition at line 53 of file test_git_check.py.
|
protected |
Run ``oct git check --json`` and return the parsed output.
Definition at line 65 of file test_git_check.py.
|
protected |
Create and switch to a non-protected branch.
Definition at line 71 of file test_git_check.py.