gpt-5.2: fix tests and imports after git queries split
Some checks failed
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / lint-shell (push) Has been cancelled
Mark stable commit / lint-python (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled
Some checks failed
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / lint-shell (push) Has been cancelled
Mark stable commit / lint-python (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled
https://chatgpt.com/share/694135eb-10a8-800f-8b12-968612f605c7 Gemini https://ai.studio/apps/drive/1QO9MaEklm2zZMDZ6XPP0LStuAooXs1NO
This commit is contained in:
@@ -7,43 +7,55 @@ from pkgmgr.core.git.commands import GitDeleteRemoteBranchError
|
||||
|
||||
|
||||
class TestDropBranch(unittest.TestCase):
|
||||
@patch("pkgmgr.actions.branch.drop_branch.input", return_value="y")
|
||||
@patch("builtins.input", return_value="y")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.get_current_branch", return_value="feature-x")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.resolve_base_branch", return_value="main")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.delete_local_branch")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.delete_remote_branch")
|
||||
def test_drop_branch_happy_path(self, delete_remote, delete_local, resolve, current, input_mock):
|
||||
def test_drop_branch_happy_path(self, delete_remote, delete_local, _resolve, _current, _input_mock) -> None:
|
||||
drop_branch(None, cwd=".")
|
||||
delete_local.assert_called_once_with("feature-x", cwd=".", force=False)
|
||||
delete_remote.assert_called_once_with("origin", "feature-x", cwd=".")
|
||||
|
||||
@patch("pkgmgr.actions.branch.drop_branch.get_current_branch", return_value="main")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.resolve_base_branch", return_value="main")
|
||||
def test_refuses_to_drop_base_branch(self, resolve, current):
|
||||
def test_refuses_to_drop_base_branch(self, _resolve, _current) -> None:
|
||||
with self.assertRaises(RuntimeError):
|
||||
drop_branch(None)
|
||||
|
||||
@patch("pkgmgr.actions.branch.drop_branch.input", return_value="n")
|
||||
@patch("builtins.input", return_value="n")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.get_current_branch", return_value="feature-x")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.resolve_base_branch", return_value="main")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.delete_local_branch")
|
||||
def test_drop_branch_aborts_on_no(self, delete_local, resolve, current, input_mock):
|
||||
def test_drop_branch_aborts_on_no(self, delete_local, _resolve, _current, _input_mock) -> None:
|
||||
drop_branch(None, cwd=".")
|
||||
delete_local.assert_not_called()
|
||||
|
||||
@patch("builtins.input")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.get_current_branch", return_value="feature-x")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.resolve_base_branch", return_value="main")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.delete_local_branch")
|
||||
def test_drop_branch_force_skips_prompt(self, delete_local, resolve, current):
|
||||
@patch("pkgmgr.actions.branch.drop_branch.delete_remote_branch")
|
||||
def test_drop_branch_force_skips_prompt(
|
||||
self,
|
||||
delete_remote,
|
||||
delete_local,
|
||||
_resolve,
|
||||
_current,
|
||||
input_mock,
|
||||
) -> None:
|
||||
drop_branch(None, cwd=".", force=True)
|
||||
delete_local.assert_called_once()
|
||||
|
||||
input_mock.assert_not_called()
|
||||
delete_local.assert_called_once_with("feature-x", cwd=".", force=False)
|
||||
delete_remote.assert_called_once_with("origin", "feature-x", cwd=".")
|
||||
|
||||
@patch("pkgmgr.actions.branch.drop_branch.get_current_branch", side_effect=GitError("fail"))
|
||||
def test_drop_branch_errors_if_no_branch_detected(self, current):
|
||||
def test_drop_branch_errors_if_no_branch_detected(self, _current) -> None:
|
||||
with self.assertRaises(RuntimeError):
|
||||
drop_branch(None)
|
||||
|
||||
@patch("pkgmgr.actions.branch.drop_branch.input", return_value="y")
|
||||
@patch("builtins.input", return_value="y")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.get_current_branch", return_value="feature-x")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.resolve_base_branch", return_value="main")
|
||||
@patch("pkgmgr.actions.branch.drop_branch.delete_local_branch")
|
||||
@@ -51,7 +63,14 @@ class TestDropBranch(unittest.TestCase):
|
||||
"pkgmgr.actions.branch.drop_branch.delete_remote_branch",
|
||||
side_effect=GitDeleteRemoteBranchError("boom", cwd="."),
|
||||
)
|
||||
def test_drop_branch_remote_delete_failure_is_wrapped(self, delete_remote, delete_local, resolve, current, input_mock):
|
||||
def test_drop_branch_remote_delete_failure_is_wrapped(
|
||||
self,
|
||||
_delete_remote,
|
||||
_delete_local,
|
||||
_resolve,
|
||||
_current,
|
||||
_input_mock,
|
||||
) -> None:
|
||||
with self.assertRaises(RuntimeError) as ctx:
|
||||
drop_branch(None, cwd=".")
|
||||
self.assertIn("remote deletion failed", str(ctx.exception))
|
||||
|
||||
Reference in New Issue
Block a user