From e8111e40f9c50c5a3a4dc64bdab0815f0cba6a80 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 22 Mar 2025 20:28:08 -0400 Subject: [PATCH] Save an MIA `breakpoint()`-restore test from prior!? It appears that during the reorg commit a356233b47fcd2431f4414e7a310e4d3a100fc58 this was intended to be moved (presumably where i have here) to `test_tooling` but was somehow just never pasted over XD Good thing this was caught while going through the remaining TODO bullets in https://pikers.dev/goodboy/tractor/pulls/2 !! Also includes fixed relative `.conftest` imports! --- tests/devx/conftest.py | 2 +- tests/devx/test_debugger.py | 1 - tests/devx/test_tooling.py | 55 ++++++++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/tests/devx/conftest.py b/tests/devx/conftest.py index e1ad2ea3..8bc800ec 100644 --- a/tests/devx/conftest.py +++ b/tests/devx/conftest.py @@ -22,7 +22,7 @@ from tractor.devx._debug import ( _repl_fail_msg as _repl_fail_msg, _ctlc_ignore_header as _ctlc_ignore_header, ) -from conftest import ( +from ..conftest import ( _ci_env, ) diff --git a/tests/devx/test_debugger.py b/tests/devx/test_debugger.py index 254b92a1..8b723c6f 100644 --- a/tests/devx/test_debugger.py +++ b/tests/devx/test_debugger.py @@ -29,7 +29,6 @@ from .conftest import ( _repl_fail_msg, ) from .conftest import ( - _ci_env, expect, in_prompt_msg, assert_before, diff --git a/tests/devx/test_tooling.py b/tests/devx/test_tooling.py index 3e48844e..1ed741e8 100644 --- a/tests/devx/test_tooling.py +++ b/tests/devx/test_tooling.py @@ -19,7 +19,13 @@ import signal from .conftest import ( expect, assert_before, - # in_prompt_msg, + in_prompt_msg, + PROMPT, + _pause_msg, +) +from pexpect.exceptions import ( + # TIMEOUT, + EOF, ) @@ -118,3 +124,50 @@ def test_shield_pause( "'--uid', \"('hanger',", ] ) + + +def test_breakpoint_hook_restored( + spawn, +): + ''' + Ensures our actor runtime sets a custom `breakpoint()` hook + on open then restores the stdlib's default on close. + + The hook state validation is done via `assert`s inside the + invoked script with only `breakpoint()` (not `tractor.pause()`) + calls used. + + ''' + child = spawn('restore_builtin_breakpoint') + + child.expect(PROMPT) + assert_before( + child, + [ + _pause_msg, + "