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

Classes

class  TestAutoBranch

Functions

bool _git_available ()
subprocess.CompletedProcess _run_commit (Path root, *str extra_args)
None _set_octrc (Path root, dict octrc)

Detailed Description

Purpose
-------
Integration tests for the auto-branching behaviour in ``oct git commit``
(Phase 4F — G-F2): when committing on a protected branch, the command
automatically creates a feature branch instead of blocking.

Responsibilities
----------------
- Verify auto-branch creates a correctly named feature branch from the
  commit message.
- Verify the commit lands on the new branch, not on the protected branch.
- Verify stderr reports the auto-branch action.
- Verify ``git.auto_branch_on_protected: false`` disables auto-branching.
- Verify branch name deduplication when the generated name already exists.

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

Contracts
---------
- All tests use subprocess invocation (same pattern as test_git_commit.py).
- All tests use tmp_path fixtures so they are automatically cleaned up.

Function Documentation

◆ _git_available()

bool tests_git.test_auto_branch._git_available ( )
protected

Definition at line 51 of file test_auto_branch.py.

◆ _run_commit()

subprocess.CompletedProcess tests_git.test_auto_branch._run_commit ( Path root,
*str extra_args )
protected
Run ``oct git commit`` in a subprocess.

Definition at line 55 of file test_auto_branch.py.

Here is the caller graph for this function:

◆ _set_octrc()

None tests_git.test_auto_branch._set_octrc ( Path root,
dict octrc )
protected
Overwrite ``.octrc.json`` in *root*.

Definition at line 65 of file test_auto_branch.py.

Here is the caller graph for this function: