Adjust `test_shield_pause` for capsys backends
Under `main_thread_forkserver` the bootstrapping hook switches to `--capture=sys`, so subactor fd-level output (tree dumps, zombie-reaper msgs) isn't captured per-test by pexpect. Gate those expects behind a `no_capfd` check so the test passes on both capture modes. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codesubint_forkserver_backend
parent
72a0465c52
commit
5a9926fc32
|
|
@ -52,6 +52,8 @@ def test_shield_pause(
|
|||
...,
|
||||
PexpectSpawner,
|
||||
],
|
||||
start_method: str,
|
||||
request: pytest.FixtureRequest,
|
||||
):
|
||||
'''
|
||||
Verify the `tractor.pause()/.post_mortem()` API works inside an
|
||||
|
|
@ -119,6 +121,21 @@ def test_shield_pause(
|
|||
# (above) and `end-of-('hanger'` (below).
|
||||
handle_out_of_order: bool = False
|
||||
|
||||
# XXX, when capfd is NOT used we don't expect to
|
||||
# see the logging output from the subactor.
|
||||
if (no_capfd := (start_method in [
|
||||
'main_thread_forkserver',
|
||||
])
|
||||
):
|
||||
opts = request.config.option
|
||||
assert opts.spawn_backend == start_method
|
||||
# ?XXX? i guess the `testdir` fixture "pretends to" reset
|
||||
# this to the default 'fd'??
|
||||
# assert opts.capture in [
|
||||
# 'sys',
|
||||
# 'no',
|
||||
# ]
|
||||
|
||||
if (
|
||||
handle_out_of_order
|
||||
and
|
||||
|
|
@ -128,10 +145,15 @@ def test_shield_pause(
|
|||
assert 'Relaying `SIGUSR1`[10] to sub-actor' in _before
|
||||
|
||||
else:
|
||||
expect(
|
||||
_before = expect(
|
||||
child,
|
||||
'Relaying `SIGUSR1`\\[10\\] to sub-actor',
|
||||
)
|
||||
# _before: str = assert_before(
|
||||
# child,
|
||||
# ["('hanger'",] # uid line
|
||||
# )
|
||||
if not no_capfd:
|
||||
expect(
|
||||
child,
|
||||
# end-of-subactor's-tree delimiter
|
||||
|
|
@ -163,14 +185,19 @@ def test_shield_pause(
|
|||
_shutdown_msg,
|
||||
timeout=6,
|
||||
)
|
||||
assert_before(
|
||||
child,
|
||||
[
|
||||
expect_on_teardown: list[str] = [
|
||||
'raise KeyboardInterrupt',
|
||||
'Root actor terminated',
|
||||
]
|
||||
if not no_capfd:
|
||||
expect_on_teardown += [
|
||||
# 'Shutting down actor runtime',
|
||||
'#T-800 deployed to collect zombie B0',
|
||||
"'--uid', \"('hanger',",
|
||||
]
|
||||
assert_before(
|
||||
child,
|
||||
expect_on_teardown,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue