|
26 | 26 | app, |
27 | 27 | ) |
28 | 28 | from pr_split.constants import AssignmentType |
29 | | -from pr_split.exceptions import PRSplitError |
| 29 | +from pr_split.exceptions import GitOperationError, PRSplitError |
30 | 30 | from pr_split.schemas import Group, GroupAssignment |
31 | 31 | from pr_split.types_defs import ForkPRInfo |
32 | 32 |
|
@@ -464,6 +464,23 @@ def test_split_fork_ref_dirty_worktree( |
464 | 464 | result = runner.invoke(app, ["split", "#42", "--dry-run"]) |
465 | 465 | assert result.exit_code != 0 |
466 | 466 |
|
| 467 | + @patch("pr_split.cli._resolve_fork_ref", side_effect=GitOperationError("PR #999 not found")) |
| 468 | + @patch("pr_split.cli.is_worktree_clean", return_value=True) |
| 469 | + @patch("pr_split.cli.check_gh_auth", return_value=True) |
| 470 | + @patch("pr_split.cli.branch_exists", return_value=False) |
| 471 | + def test_split_fork_ref_error_is_reported_not_raised( |
| 472 | + self, |
| 473 | + mock_be: MagicMock, |
| 474 | + mock_auth: MagicMock, |
| 475 | + mock_clean: MagicMock, |
| 476 | + mock_resolve: MagicMock, |
| 477 | + ) -> None: |
| 478 | + result = runner.invoke(app, ["split", "#999", "--dry-run"]) |
| 479 | + assert result.exit_code == 1 |
| 480 | + assert result.exception is None or isinstance(result.exception, SystemExit) |
| 481 | + assert "PR #999 not found" in result.output |
| 482 | + assert "Traceback" not in result.output |
| 483 | + |
467 | 484 | @patch("pr_split.cli._resolve_fork_ref", return_value=None) |
468 | 485 | @patch("pr_split.cli.is_worktree_clean", return_value=True) |
469 | 486 | @patch("pr_split.cli.check_gh_auth", return_value=True) |
|
0 commit comments