diff --git a/examples/debugging/subactor_bp_in_ctx.py b/examples/debugging/subactor_bp_in_ctx.py index 2c5fee8c..f55d2cd4 100644 --- a/examples/debugging/subactor_bp_in_ctx.py +++ b/examples/debugging/subactor_bp_in_ctx.py @@ -33,8 +33,11 @@ async def just_bp( async def main(): + async with tractor.open_nursery( debug_mode=True, + enable_transports=['uds'], + loglevel='devx', ) as n: p = await n.start_actor( 'bp_boi', diff --git a/tests/devx/test_debugger.py b/tests/devx/test_debugger.py index b9f3d9a1..6179ef01 100644 --- a/tests/devx/test_debugger.py +++ b/tests/devx/test_debugger.py @@ -10,10 +10,14 @@ TODO: - wonder if any of it'll work on OS X? """ +from __future__ import annotations from functools import partial import itertools import platform import time +from typing import ( + TYPE_CHECKING, +) import pytest from pexpect.exceptions import ( @@ -34,6 +38,9 @@ from .conftest import ( assert_before, ) +if TYPE_CHECKING: + from ..conftest import PexpectSpawner + # TODO: The next great debugger audit could be done by you! # - recurrent entry to breakpoint() from single actor *after* and an # error in another task? @@ -1062,6 +1069,88 @@ def test_shield_pause( child.expect(EOF) +@pytest.mark.parametrize( + 'quit_early', [False, True] +) +def test_ctxep_pauses_n_maybe_ipc_breaks( + spawn: PexpectSpawner, + quit_early: bool, +): + ''' + Audit generator embedded `.pause()`es from within a `@context` + endpoint with a chan close at the end, requiring that ctl-c is + mashed and zombie reaper kills sub with no hangs. + + ''' + child = spawn('subactor_bp_in_ctx') + child.expect(PROMPT) + + # 3 iters for the `gen()` pause-points + for i in range(3): + assert_before( + child, + [ + _pause_msg, + "('bp_boi'", # actor name + "