Use `.aid` fields over deprecated `.uid` in tests
Mirror the core swap on the test side: every `Channel`/`Actor` `.uid` access now reads the non-deprecated `.aid` struct's `(.name, .uuid)` (or `.aid.name` for a `.uid[0]`), keeping the compared / printed value byte-identical while silencing the self-inflicted `DeprecationWarning`. Touches `test_context_stream_semantics`, `test_spawning`, `test_local`, `test_advanced_streaming`, `msg.test_ext_types_msgspec`, `discovery.test_multi_program`, `test_infected_asyncio`. (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codewkt/rm_test_warnings
parent
727aee0f84
commit
4607090a5d
|
|
@ -122,7 +122,13 @@ def test_register_duplicate_name(
|
||||||
'test_register_duplicate_name: '
|
'test_register_duplicate_name: '
|
||||||
'`wait_for_actor` returned'
|
'`wait_for_actor` returned'
|
||||||
)
|
)
|
||||||
assert portal.channel.uid in (p2.channel.uid, p1.channel.uid)
|
assert (
|
||||||
|
(portal.channel.aid.name, portal.channel.aid.uuid)
|
||||||
|
in (
|
||||||
|
(p2.channel.aid.name, p2.channel.aid.uuid),
|
||||||
|
(p1.channel.aid.name, p1.channel.aid.uuid),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
log.cancel(
|
log.cancel(
|
||||||
'test_register_duplicate_name: '
|
'test_register_duplicate_name: '
|
||||||
|
|
@ -242,8 +248,14 @@ def test_dup_name_cancel_cascade_escalates_to_hard_kill(
|
||||||
# name; doesn't matter which one (registrar will
|
# name; doesn't matter which one (registrar will
|
||||||
# have last-wins semantics under same-name).
|
# have last-wins semantics under same-name).
|
||||||
async with tractor.wait_for_actor('doggy') as portal:
|
async with tractor.wait_for_actor('doggy') as portal:
|
||||||
expected_uids = {p.channel.uid for p in portals}
|
expected_uids = {
|
||||||
assert portal.channel.uid in expected_uids
|
(p.channel.aid.name, p.channel.aid.uuid)
|
||||||
|
for p in portals
|
||||||
|
}
|
||||||
|
assert (
|
||||||
|
(portal.channel.aid.name, portal.channel.aid.uuid)
|
||||||
|
in expected_uids
|
||||||
|
)
|
||||||
|
|
||||||
# critical section: this MUST return within
|
# critical section: this MUST return within
|
||||||
# `fail_after_s` even when one or more cancel-RPC
|
# `fail_after_s` even when one or more cancel-RPC
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,10 @@ def enc_nsp(obj: Any) -> Any:
|
||||||
actor: Actor = tractor.current_actor(
|
actor: Actor = tractor.current_actor(
|
||||||
err_on_no_runtime=False,
|
err_on_no_runtime=False,
|
||||||
)
|
)
|
||||||
uid: tuple[str, str]|None = None if not actor else actor.uid
|
uid: tuple[str, str]|None = (
|
||||||
|
None if not actor
|
||||||
|
else (actor.aid.name, actor.aid.uuid)
|
||||||
|
)
|
||||||
print(f'{uid} ENC HOOK')
|
print(f'{uid} ENC HOOK')
|
||||||
|
|
||||||
match obj:
|
match obj:
|
||||||
|
|
@ -95,7 +98,10 @@ def dec_nsp(
|
||||||
actor: Actor = tractor.current_actor(
|
actor: Actor = tractor.current_actor(
|
||||||
err_on_no_runtime=False,
|
err_on_no_runtime=False,
|
||||||
)
|
)
|
||||||
uid: tuple[str, str]|None = None if not actor else actor.uid
|
uid: tuple[str, str]|None = (
|
||||||
|
None if not actor
|
||||||
|
else (actor.aid.name, actor.aid.uuid)
|
||||||
|
)
|
||||||
print(
|
print(
|
||||||
f'{uid}\n'
|
f'{uid}\n'
|
||||||
'CUSTOM DECODE\n'
|
'CUSTOM DECODE\n'
|
||||||
|
|
@ -419,7 +425,8 @@ async def send_back_values(
|
||||||
and ensure we can round trip a func ref with our parent.
|
and ensure we can round trip a func ref with our parent.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
uid: tuple = tractor.current_actor().uid
|
_aid = tractor.current_actor().aid
|
||||||
|
uid: tuple = (_aid.name, _aid.uuid)
|
||||||
|
|
||||||
# init state in sub-actor should be default
|
# init state in sub-actor should be default
|
||||||
chk_codec_applied(
|
chk_codec_applied(
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ async def subscribe(
|
||||||
new_subs = set(new_subs)
|
new_subs = set(new_subs)
|
||||||
remove = new_subs - _registry.keys()
|
remove = new_subs - _registry.keys()
|
||||||
|
|
||||||
print(f'setting sub to {new_subs} for {ctx.chan.uid}')
|
print(f'setting sub to {new_subs} for {(ctx.chan.aid.name, ctx.chan.aid.uuid)}')
|
||||||
|
|
||||||
# remove old subs
|
# remove old subs
|
||||||
for sub in remove:
|
for sub in remove:
|
||||||
|
|
@ -84,7 +84,8 @@ async def consumer(
|
||||||
subs: list[str],
|
subs: list[str],
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
uid = tractor.current_actor().uid
|
_aid = tractor.current_actor().aid
|
||||||
|
uid = (_aid.name, _aid.uuid)
|
||||||
|
|
||||||
async with tractor.wait_for_actor('publisher') as portal:
|
async with tractor.wait_for_actor('publisher') as portal:
|
||||||
async with portal.open_context(subscribe) as (ctx, first):
|
async with portal.open_context(subscribe) as (ctx, first):
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ def test_parent_cancels(
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
) -> None:
|
) -> None:
|
||||||
actor: Actor = current_actor()
|
actor: Actor = current_actor()
|
||||||
uid: tuple = actor.uid
|
uid: tuple = (actor.aid.name, actor.aid.uuid)
|
||||||
_ctxc: ContextCancelled|None = None
|
_ctxc: ContextCancelled|None = None
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
@ -712,9 +712,9 @@ async def test_parent_exits_ctx_after_child_enters_stream(
|
||||||
assert (
|
assert (
|
||||||
ctxc.canceller
|
ctxc.canceller
|
||||||
==
|
==
|
||||||
current_actor().uid
|
(current_actor().aid.name, current_actor().aid.uuid)
|
||||||
==
|
==
|
||||||
root.uid
|
(root.aid.name, root.aid.uuid)
|
||||||
)
|
)
|
||||||
|
|
||||||
# channel should still be up
|
# channel should still be up
|
||||||
|
|
@ -1219,7 +1219,7 @@ def test_maybe_allow_overruns_stream(
|
||||||
|
|
||||||
if cancel_ctx:
|
if cancel_ctx:
|
||||||
assert isinstance(res, ContextCancelled)
|
assert isinstance(res, ContextCancelled)
|
||||||
assert tuple(res.canceller) == current_actor().uid
|
assert tuple(res.canceller) == (current_actor().aid.name, current_actor().aid.uuid)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(f'RX ROOT SIDE RESULT {res}')
|
print(f'RX ROOT SIDE RESULT {res}')
|
||||||
|
|
|
||||||
|
|
@ -956,7 +956,7 @@ async def manage_file(
|
||||||
'''
|
'''
|
||||||
|
|
||||||
tmp_path: Path = Path(tmp_path_str)
|
tmp_path: Path = Path(tmp_path_str)
|
||||||
tmp_file: Path = tmp_path / f'{" ".join(ctx._actor.uid)}.file'
|
tmp_file: Path = tmp_path / f'{" ".join((ctx._actor.aid.name, ctx._actor.aid.uuid))}.file'
|
||||||
|
|
||||||
# create a the tmp file and tell the parent where it's at
|
# create a the tmp file and tell the parent where it's at
|
||||||
assert not tmp_file.is_file()
|
assert not tmp_file.is_file()
|
||||||
|
|
@ -1180,7 +1180,7 @@ def test_sigint_closes_lifetime_stack(
|
||||||
):
|
):
|
||||||
await ctx.wait_for_result()
|
await ctx.wait_for_result()
|
||||||
except tractor.ContextCancelled as ctxc:
|
except tractor.ContextCancelled as ctxc:
|
||||||
assert ctxc.canceller == ctx.chan.uid
|
assert ctxc.canceller == (ctx.chan.aid.name, ctx.chan.aid.uuid)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
except trio.TooSlowError:
|
except trio.TooSlowError:
|
||||||
|
|
@ -1300,7 +1300,7 @@ async def caching_ep(
|
||||||
},
|
},
|
||||||
|
|
||||||
# lock around current actor task access
|
# lock around current actor task access
|
||||||
key=tractor.current_actor().uid,
|
key=(tractor.current_actor().aid.name, tractor.current_actor().aid.uuid),
|
||||||
|
|
||||||
) as (cache_hit, (clients, chan)),
|
) as (cache_hit, (clients, chan)),
|
||||||
):
|
):
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ async def test_self_is_registered(reg_addr):
|
||||||
assert actor.is_registrar
|
assert actor.is_registrar
|
||||||
with trio.fail_after(0.2):
|
with trio.fail_after(0.2):
|
||||||
async with tractor.wait_for_actor('root') as portal:
|
async with tractor.wait_for_actor('root') as portal:
|
||||||
assert portal.channel.uid[0] == 'root'
|
assert portal.channel.aid.name == 'root'
|
||||||
|
|
||||||
|
|
||||||
@tractor_test
|
@tractor_test
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ async def spawn(
|
||||||
|
|
||||||
assert len(an._children) == 1
|
assert len(an._children) == 1
|
||||||
assert (
|
assert (
|
||||||
portal.channel.uid
|
(portal.channel.aid.name, portal.channel.aid.uuid)
|
||||||
in
|
in
|
||||||
tractor.current_actor().ipc_server._peers
|
tractor.current_actor().ipc_server._peers
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue