Skip to content

Commit 9b05f65

Browse files
committed
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
1 parent 65fcfbf commit 9b05f65

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

tests/test_advanced_streaming.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ async def subscribe(
7676

7777

7878
async def consumer(
79-
8079
subs: list[str],
81-
8280
) -> None:
8381

8482
uid = tractor.current_actor().uid
@@ -108,15 +106,21 @@ async def consumer(
108106
print(f'{uid} got: {value}')
109107

110108

111-
def test_dynamic_pub_sub():
112-
109+
def test_dynamic_pub_sub(
110+
reg_addr: tuple,
111+
debug_mode: bool,
112+
test_log: tractor.log.StackLevelAdapter,
113+
):
113114
global _registry
114115

115116
from multiprocessing import cpu_count
116117
cpus = cpu_count()
117118

118119
async def main():
119-
async with tractor.open_nursery() as n:
120+
async with tractor.open_nursery(
121+
registry_addrs=[reg_addr],
122+
debug_mode=debug_mode,
123+
) as n:
120124

121125
# name of this actor will be same as target func
122126
await n.run_in_actor(publisher)
@@ -155,12 +159,13 @@ async def main():
155159
else:
156160
pytest.fail('Never got a `TooSlowError` ?')
157161

162+
assert err
163+
test_log.exception('Timed out AS EXPECTED')
164+
158165

159166
@tractor.context
160167
async def one_task_streams_and_one_handles_reqresp(
161-
162168
ctx: tractor.Context,
163-
164169
) -> None:
165170

166171
await ctx.started()
@@ -257,7 +262,8 @@ async def echo_ctx_stream(
257262

258263

259264
def test_sigint_both_stream_types():
260-
'''Verify that running a bi-directional and recv only stream
265+
'''
266+
Verify that running a bi-directional and recv only stream
261267
side-by-side will cancel correctly from SIGINT.
262268
263269
'''

0 commit comments

Comments
 (0)