|
Option C Tools
|
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) | |
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.
|
protected |
| tests_git.test_git_commit_msg.test_breaking_change_marker_accepted | ( | Path | tmp_path | ) |
| tests_git.test_git_commit_msg.test_invalid_commit_no_type_exits_1 | ( | Path | tmp_path | ) |
| tests_git.test_git_commit_msg.test_invalid_with_json_emits_valid_false | ( | Path | tmp_path | ) |
| 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.
| 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.
| tests_git.test_git_commit_msg.test_valid_conventional_commit_exits_0 | ( | Path | tmp_path | ) |
| tests_git.test_git_commit_msg.test_valid_with_json_emits_valid_true | ( | Path | tmp_path | ) |