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

Classes

class  TestSnapshot
class  TestDiffSnapshots
class  TestObserverWarnDefault
class  TestObserverBlock
class  TestObserverOverride

Functions

bool _git_available ()
 _git (Path repo, *str args, bool check=True)
Path git_repo (Path tmp_path)
subprocess.CompletedProcess _run_commit (Path project_root, *str extra_args, dict|None env=None)

Detailed Description

Purpose
-------
Validate the B1.0 commit observer that detects silent mutations of
tracked-but-unstaged files during ``oct git commit``.

Responsibilities
----------------
- Unit tests for ``snapshot_unstaged_tracked`` and ``diff_snapshots``
  in ``oct.git.commit_observer``: snapshot excludes staged files,
  detects content drift, handles oversized files via sentinel.
- Integration tests for the warn/block modes wired into
  ``git_commit_cmd``: a synthetic mutation between snapshot points
  produces the expected stderr warning, and the block mode aborts
  with exit code 6.

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

Contracts
---------
- All tests use subprocess invocation against ``oct.cli`` for
  integration-level checks; unit tests import the helper directly.
- All tests use tmp_path fixtures so they are automatically cleaned up.

Function Documentation

◆ _git()

tests_git.test_commit_observer._git ( Path repo,
*str args,
bool check = True )
protected

Definition at line 55 of file test_commit_observer.py.

Here is the caller graph for this function:

◆ _git_available()

bool tests_git.test_commit_observer._git_available ( )
protected

Definition at line 51 of file test_commit_observer.py.

Here is the caller graph for this function:

◆ _run_commit()

subprocess.CompletedProcess tests_git.test_commit_observer._run_commit ( Path project_root,
*str extra_args,
dict | None env = None )
protected

Definition at line 162 of file test_commit_observer.py.

Here is the caller graph for this function:

◆ git_repo()

Path tests_git.test_commit_observer.git_repo ( Path tmp_path)
Bare-bones git repo for unit-level snapshot tests.

Definition at line 63 of file test_commit_observer.py.

Here is the call graph for this function: