From 9b05f659b3dbdcf6ad9869e18ca2eb62b91fbdc1 Mon Sep 17 00:00:00 2001 From: goodboy Date: Mon, 27 Apr 2026 12:59:00 -0400 Subject: [PATCH] Wire `test_dynamic_pub_sub` to standard fixtures Pull in the `reg_addr`, `debug_mode`, and `test_log` fixtures so this test follows the same conventions as the rest of the suite: - pass `registry_addrs=[reg_addr]` + `debug_mode` into `tractor.open_nursery()` (so `--tpdb` etc work). - after the `pytest.raises` block, add `assert err` + `test_log.exception('Timed out AS EXPECTED')` so the expected timeout is logged explicitly instead of swallowed. Also, - drop whitespace-only blank lines around the `subs` param of `consumer()` and `ctx` param of `one_task_streams_and_one_handles_reqresp()`. - promote `test_sigint_both_stream_types`'s one-line docstring to multi-line form. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- tests/test_advanced_streaming.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/test_advanced_streaming.py b/tests/test_advanced_streaming.py index 907a2196..89191a4b 100644 --- a/tests/test_advanced_streaming.py +++ b/tests/test_advanced_streaming.py @@ -76,9 +76,7 @@ async def subscribe( async def consumer( - subs: list[str], - ) -> None: uid = tractor.current_actor().uid @@ -108,15 +106,21 @@ async def consumer( print(f'{uid} got: {value}') -def test_dynamic_pub_sub(): - +def test_dynamic_pub_sub( + reg_addr: tuple, + debug_mode: bool, + test_log: tractor.log.StackLevelAdapter, +): global _registry from multiprocessing import cpu_count cpus = cpu_count() async def main(): - async with tractor.open_nursery() as n: + async with tractor.open_nursery( + registry_addrs=[reg_addr], + debug_mode=debug_mode, + ) as n: # name of this actor will be same as target func await n.run_in_actor(publisher) @@ -155,12 +159,13 @@ def test_dynamic_pub_sub(): else: pytest.fail('Never got a `TooSlowError` ?') + assert err + test_log.exception('Timed out AS EXPECTED') + @tractor.context async def one_task_streams_and_one_handles_reqresp( - ctx: tractor.Context, - ) -> None: await ctx.started() @@ -257,7 +262,8 @@ async def echo_ctx_stream( def test_sigint_both_stream_types(): - '''Verify that running a bi-directional and recv only stream + ''' + Verify that running a bi-directional and recv only stream side-by-side will cancel correctly from SIGINT. '''