Skip to content

Commit ec2b21c

Browse files
committed
tests: use non-control-signal BaseException in safe_run fail-soft test
1 parent 6aa53b6 commit ec2b21c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tests/test_coverage_iter245.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ def test_safe_run_emits_continue_on_dispatch_exception(tmp_path, capsys):
3838

3939

4040
def test_safe_run_emits_continue_on_base_exception(capsys):
41-
"""BaseException in dispatch must still call emit with continue=true."""
41+
"""Non-control-signal BaseException in dispatch must still emit continue=true.
42+
43+
``safe_run`` deliberately re-raises ``KeyboardInterrupt`` and ``SystemExit``
44+
so process-control signals propagate; this test exercises the broad
45+
fail-soft path for every other BaseException subclass.
46+
"""
47+
class _CustomBaseExc(BaseException):
48+
pass
49+
4250
with (
4351
patch("token_goat.hooks_cli.read_payload", return_value={}),
4452
patch("token_goat.hooks_cli.normalize_payload", return_value={}),
45-
patch("token_goat.hooks_cli.dispatch", side_effect=KeyboardInterrupt()),
53+
patch("token_goat.hooks_cli.dispatch", side_effect=_CustomBaseExc("boom")),
4654
patch("token_goat.hooks_cli.emit") as mock_emit,
4755
):
4856
safe_run("session-start")

0 commit comments

Comments
 (0)