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

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)

Detailed Description

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.

Function Documentation

◆ _latest_audit_record()

dict | None tests_git.test_git_check._latest_audit_record ( Path root)
protected
Read the last JSONL record from the newest audit file.

Definition at line 76 of file test_git_check.py.

Here is the caller graph for this function:

◆ _run_check()

subprocess.CompletedProcess tests_git.test_git_check._run_check ( Path root,
*str extra_args )
protected
Run ``oct git check`` in a subprocess and return the result.

Definition at line 53 of file test_git_check.py.

Here is the caller graph for this function:

◆ _run_check_json()

dict tests_git.test_git_check._run_check_json ( Path root,
*str extra_args )
protected
Run ``oct git check --json`` and return the parsed output.

Definition at line 65 of file test_git_check.py.

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

◆ _switch_to_feature_branch()

tests_git.test_git_check._switch_to_feature_branch ( Path root,
str branch = "feature/test" )
protected
Create and switch to a non-protected branch.

Definition at line 71 of file test_git_check.py.

Here is the caller graph for this function: