From cd287c7e93380558ab67e9b516ff7533e17893b0 Mon Sep 17 00:00:00 2001 From: goodboy Date: Tue, 14 Apr 2026 15:16:57 -0400 Subject: [PATCH] Fix `test_registrar_merge_binds_union` for UDS collision `get_random()` can produce the same UDS filename for a given pid+actor-state, so the "disjoint addrs" premise doesn't always hold. Gate the `len(bound) >= 2` assertion on whether the registry and bind addrs actually differ via `expect_disjoint`. Also, - drop unused `partial` import (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- tests/discovery/test_tpt_bind_addrs.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/discovery/test_tpt_bind_addrs.py b/tests/discovery/test_tpt_bind_addrs.py index 61baecda..ae3b3437 100644 --- a/tests/discovery/test_tpt_bind_addrs.py +++ b/tests/discovery/test_tpt_bind_addrs.py @@ -9,8 +9,6 @@ bind-address selection in `_root.py`: 3. Explicit bind given -> wraps via `wrap_address()` and uses them ''' -from functools import partial - import pytest import trio import tractor @@ -283,6 +281,15 @@ def test_registrar_merge_binds_union( ) bind_addrs = [rando.unwrap()] + # NOTE: for UDS, `get_random()` produces the same + # filename for the same pid+actor-state, so the + # "disjoint" premise only holds when the addrs + # actually differ (always true for TCP, may + # collide for UDS). + expect_disjoint: bool = ( + tuple(reg_addr) != rando.unwrap() + ) + async def _main(): async with tractor.open_root_actor( registry_addrs=[reg_addr], @@ -295,8 +302,9 @@ def test_registrar_merge_binds_union( bound = actor.accept_addrs bound_w = _bound_wrapped(actor) - # must have at least 2 (registry + bind) - assert len(bound) >= 2 + if expect_disjoint: + # must have at least 2 (registry + bind) + assert len(bound) >= 2 # registry addr must appear in bound set assert reg_wrapped in bound_w