mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 23:47:54 +08:00
test: cover the notify install gate
`_setup_hooks` installs the wait hook only for an interactive run: a one-shot `plyngent "…"` never waits on a human, so `[notify]` must not arm a notifier that could never fire. The test asserts the hook is cleared again when the run is not interactive.
This commit is contained in:
@@ -99,6 +99,20 @@ def test_setup_hooks_installs_pty_hook_for_auto_continue(clean_auto_continue: No
|
|||||||
assert PtyManager._limit_continue is None
|
assert PtyManager._limit_continue is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_setup_hooks_installs_the_notifier_only_for_an_interactive_run(clean_auto_continue: None) -> None:
|
||||||
|
"""A one-shot run never waits on a human, so it installs no wait hook."""
|
||||||
|
del clean_auto_continue
|
||||||
|
from plyngent.cli.app import _setup_hooks
|
||||||
|
from plyngent.config.models import NotifyConfig
|
||||||
|
|
||||||
|
_setup_hooks(interactive=False, auto_continue=False, notify=NotifyConfig())
|
||||||
|
assert get_prompt_wait_hook() is None
|
||||||
|
_setup_hooks(interactive=True, auto_continue=False, notify=NotifyConfig())
|
||||||
|
assert get_prompt_wait_hook() is not None
|
||||||
|
_setup_hooks(interactive=False, auto_continue=False, notify=NotifyConfig())
|
||||||
|
assert get_prompt_wait_hook() is None
|
||||||
|
|
||||||
|
|
||||||
def test_pty_offer_raise_uses_auto_continue(clean_auto_continue: None) -> None:
|
def test_pty_offer_raise_uses_auto_continue(clean_auto_continue: None) -> None:
|
||||||
del clean_auto_continue
|
del clean_auto_continue
|
||||||
PtyManager.set_limit_continue_hook(prompt_continue_limit)
|
PtyManager.set_limit_continue_hook(prompt_continue_limit)
|
||||||
|
|||||||
Reference in New Issue
Block a user