Avoid silent `stackscope`-test fail due to dep

Oddly my env was borked bc a missing sub-dep (`typing-extensions`
apparently not added by `uv` for `stackscope`?) and then `stackscope`
was silently failing import and caused the shield-pause test to also
fail (since it couldn't match the expected `log.devx()` on console). The
import failure is not very explanatory due to the `log.warning()`;
change it to `.error()` level.

Also, explicitly import `_sync_pause_from_builtin` in
`examples/debugging/restore_builtin_breakpoint.py` to ensure the ref is
exported properly from `.devx.debug` (which it wasn't during dev of the
prior commit Bp).
main
Tyler Goodlet 2025-05-15 15:08:21 -04:00
parent 309360daa2
commit c2e7dc7407
3 changed files with 9 additions and 4 deletions

View File

@ -4,6 +4,11 @@ import sys
import trio import trio
import tractor import tractor
# ensure mod-path is correct!
from tractor.devx.debug import (
_sync_pause_from_builtin as _sync_pause_from_builtin,
)
async def main() -> None: async def main() -> None:
@ -13,6 +18,7 @@ async def main() -> None:
async with tractor.open_nursery( async with tractor.open_nursery(
debug_mode=True, debug_mode=True,
loglevel='devx',
) as an: ) as an:
assert an assert an
assert ( assert (

View File

@ -63,7 +63,6 @@ dev = [
"stackscope>=0.2.2,<0.3", "stackscope>=0.2.2,<0.3",
# ^ requires this? # ^ requires this?
"typing-extensions>=4.14.1", "typing-extensions>=4.14.1",
"pyperclip>=1.9.0", "pyperclip>=1.9.0",
"prompt-toolkit>=3.0.50", "prompt-toolkit>=3.0.50",
"xonsh>=0.19.2", "xonsh>=0.19.2",

View File

@ -237,7 +237,7 @@ def enable_stack_on_sig(
try: try:
import stackscope import stackscope
except ImportError: except ImportError:
log.warning( log.error(
'`stackscope` not installed for use in debug mode!' '`stackscope` not installed for use in debug mode!'
) )
return None return None
@ -255,8 +255,8 @@ def enable_stack_on_sig(
dump_tree_on_sig, dump_tree_on_sig,
) )
log.devx( log.devx(
'Enabling trace-trees on `SIGUSR1` ' f'Enabling trace-trees on `SIGUSR1` '
'since `stackscope` is installed @ \n' f'since `stackscope` is installed @ \n'
f'{stackscope!r}\n\n' f'{stackscope!r}\n\n'
f'With `SIGUSR1` handler\n' f'With `SIGUSR1` handler\n'
f'|_{dump_tree_on_sig}\n' f'|_{dump_tree_on_sig}\n'