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

Classes

class  TestRestoreWorkingTree
class  TestRestoreStaged
class  TestRestoreAll
class  TestRestoreEmpty
class  TestRestoreJson

Functions

bool _git_available ()
subprocess.CompletedProcess _run_restore (Path root, *str extra_args)
list[str] _staged_names (Path repo)

Detailed Description

Purpose
-------
Integration tests for ``oct git restore`` (L3).

Responsibilities
----------------
- Verify ``oct git restore <path>`` reverts unstaged working-tree
  edits.
- Verify ``oct git restore --staged <path>`` unstages from the index
  without touching the working tree.
- Verify ``--all`` enumerates in-scope paths.
- Verify the confirmation prompt for ``--staged --all`` (and
  ``--yes`` bypass).
- Verify path-scope filtering (paths outside the project root are
  skipped) and JSON output.

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

Contracts
---------
- All tests use subprocess invocation against ``oct.cli``.
- All tests use tmp_path fixtures so they are automatically cleaned up.

Function Documentation

◆ _git_available()

bool tests_git.test_git_restore._git_available ( )
protected

Definition at line 46 of file test_git_restore.py.

◆ _run_restore()

subprocess.CompletedProcess tests_git.test_git_restore._run_restore ( Path root,
*str extra_args )
protected

Definition at line 50 of file test_git_restore.py.

Here is the caller graph for this function:

◆ _staged_names()

list[str] tests_git.test_git_restore._staged_names ( Path repo)
protected

Definition at line 59 of file test_git_restore.py.

Here is the caller graph for this function: