mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
test(line): skip dual-stack both-families assertion on IPv4-only hosts
test_default_bind_serves_both_families asserts an IPv6 listening socket exists, which is the environment's capability, not the adapter's — CI runners with IPv6 disabled would flake. Probe an actual ::1 bind (not just socket.has_ipv6, a compile-time constant) and skip cleanly when the host has no usable IPv6 stack.
This commit is contained in:
parent
e24bb0b42f
commit
cf1e3585b6
1 changed files with 15 additions and 0 deletions
|
|
@ -804,6 +804,21 @@ class TestDualStackBind:
|
|||
@pytest.mark.asyncio
|
||||
async def test_default_bind_serves_both_families(self, monkeypatch):
|
||||
"""Behavioural proof: host=None opens v4 AND v6 listening sockets."""
|
||||
# Guard: on IPv4-only hosts (CI runners with IPv6 disabled) the
|
||||
# dual-stack bind legitimately yields no v6 socket — that's the
|
||||
# environment, not a regression. Probe an actual ::1 bind rather
|
||||
# than trusting socket.has_ipv6 (compile-time constant).
|
||||
import socket as _socket
|
||||
if not _socket.has_ipv6:
|
||||
pytest.skip("IPv6 not supported by this Python build")
|
||||
try:
|
||||
_probe = _socket.socket(_socket.AF_INET6, _socket.SOCK_STREAM)
|
||||
try:
|
||||
_probe.bind(("::1", 0))
|
||||
finally:
|
||||
_probe.close()
|
||||
except OSError:
|
||||
pytest.skip("IPv6 stack unavailable on this host (cannot bind ::1)")
|
||||
monkeypatch.delenv("LINE_HOST", raising=False)
|
||||
ad = LineAdapter(self._cfg(port=0))
|
||||
ad._client = MagicMock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue