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

Functions

 _run (Path tmp_path, str message, *str extra)
 test_valid_conventional_commit_exits_0 (Path tmp_path)
 test_invalid_commit_no_type_exits_1 (Path tmp_path)
 test_valid_with_json_emits_valid_true (Path tmp_path)
 test_invalid_with_json_emits_valid_false (Path tmp_path)
 test_breaking_change_marker_accepted (Path tmp_path)
 test_missing_file_exits_nonzero (Path tmp_path)
 test_subprocess_roundtrip (Path tmp_path)

Detailed Description

Purpose
-------
OI-503 regression tests — verify ``oct git commit-msg <file>`` exists and
validates Conventional Commit messages correctly. Without this command, every
``oct git hooks install`` produces a broken commit-msg hook (the hook template
already references this entry, but the command was missing in v0.16.0).

Responsibilities
----------------
- Valid Conventional Commit → exit 0.
- Invalid (no type) → exit 1 + error on stderr.
- --json on valid → exit 0 + JSON with ``"valid": true``.
- --json on invalid → exit 1 + JSON with ``"valid": false`` and errors.
- Scoped breaking-change (``feat!: ...``) is accepted.
- Missing file → Click exits 2 (argument validation).

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

Contracts
---------
- The command must never raise; it must always exit with a numeric code.

Function Documentation

◆ _run()

tests_git.test_git_commit_msg._run ( Path tmp_path,
str message,
*str extra )
protected

Definition at line 46 of file test_git_commit_msg.py.

Here is the caller graph for this function:

◆ test_breaking_change_marker_accepted()

tests_git.test_git_commit_msg.test_breaking_change_marker_accepted ( Path tmp_path)

Definition at line 87 of file test_git_commit_msg.py.

Here is the call graph for this function:

◆ test_invalid_commit_no_type_exits_1()

tests_git.test_git_commit_msg.test_invalid_commit_no_type_exits_1 ( Path tmp_path)

Definition at line 61 of file test_git_commit_msg.py.

Here is the call graph for this function:

◆ test_invalid_with_json_emits_valid_false()

tests_git.test_git_commit_msg.test_invalid_with_json_emits_valid_false ( Path tmp_path)

Definition at line 79 of file test_git_commit_msg.py.

Here is the call graph for this function:

◆ test_missing_file_exits_nonzero()

tests_git.test_git_commit_msg.test_missing_file_exits_nonzero ( Path tmp_path)

Definition at line 92 of file test_git_commit_msg.py.

◆ test_subprocess_roundtrip()

tests_git.test_git_commit_msg.test_subprocess_roundtrip ( Path tmp_path)
Smoke test via ``python -m oct.cli git commit-msg`` as pre-commit would run it.

Definition at line 102 of file test_git_commit_msg.py.

◆ test_valid_conventional_commit_exits_0()

tests_git.test_git_commit_msg.test_valid_conventional_commit_exits_0 ( Path tmp_path)

Definition at line 55 of file test_git_commit_msg.py.

Here is the call graph for this function:

◆ test_valid_with_json_emits_valid_true()

tests_git.test_git_commit_msg.test_valid_with_json_emits_valid_true ( Path tmp_path)

Definition at line 71 of file test_git_commit_msg.py.

Here is the call graph for this function: