test(app_controller_sigint): update _FakeController for Phase 6 Result-based helpers
The Phase 6 Group 6.1 migration changed _install_sigint_exit_handler to call controller._install_signal_handler_result(handler) and controller._shutdown_io_pool_result(). The _FakeController test stub needs to provide these new helpers to maintain the test contract.
This commit is contained in:
@@ -49,12 +49,38 @@ def restore_sigint():
|
||||
|
||||
|
||||
class _FakeController:
|
||||
"""Minimal stand-in for AppController: just exposes _io_pool."""
|
||||
"""Minimal stand-in for AppController: just exposes _io_pool + the
|
||||
Result-based signal-handler helpers added in Phase 6 Group 6.1."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._io_pool = ThreadPoolExecutor(
|
||||
max_workers=2, thread_name_prefix="fake-ctrl"
|
||||
)
|
||||
self._signal_handler_error = None
|
||||
|
||||
def _shutdown_io_pool_result(self):
|
||||
"""Phase 6 Group 6.1 helper (Result-based)."""
|
||||
from src.result_types import OK, ErrorInfo, ErrorKind, Result
|
||||
try:
|
||||
self._io_pool.shutdown(wait=False)
|
||||
return OK
|
||||
except Exception as e:
|
||||
return Result(data=None, errors=[ErrorInfo(
|
||||
kind=ErrorKind.INTERNAL, message=str(e),
|
||||
source="app_controller._shutdown_io_pool_result", original=e,
|
||||
)])
|
||||
|
||||
def _install_signal_handler_result(self, handler):
|
||||
"""Phase 6 Group 6.1 helper (Result-based)."""
|
||||
from src.result_types import OK, ErrorInfo, ErrorKind, Result
|
||||
try:
|
||||
signal.signal(signal.SIGINT, handler)
|
||||
return OK
|
||||
except Exception as e:
|
||||
return Result(data=None, errors=[ErrorInfo(
|
||||
kind=ErrorKind.INTERNAL, message=str(e),
|
||||
source="app_controller._install_signal_handler_result", original=e,
|
||||
)])
|
||||
|
||||
|
||||
def test_install_sigint_handler_installs_callable(restore_sigint: Any) -> None:
|
||||
|
||||
Reference in New Issue
Block a user