test(tests): make the body-retry, websocket debug-entry and gzip segment tests deterministic

This commit is contained in:
imSp4rky
2026-12-05 10:13:04 -07:00
parent 00ad15527c
commit 9de59f3142
4 changed files with 16 additions and 10 deletions
+5 -4
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
import asyncio
import re
from collections.abc import Callable
from pathlib import Path
from typing import Any
@@ -106,9 +107,9 @@ async def test_each_handshake_writes_one_debug_entry(debug_log: Path) -> None:
with pytest.raises(rnet.ConnectionError):
await call(session.websocket, closed_port().replace("http://", "ws://", 1), GIVEN)
assert [
first, refused = [
(entry["request"]["method"], entry["response"]["status"], entry["failure"]) for entry in records(debug_log)
] == [
("GET", 101, None),
("GET", None, "ConnectionError (Connection refused)"),
]
assert first == ("GET", 101, None)
assert refused[:2] == ("GET", None)
assert re.fullmatch(r"ConnectionError \([^/]+\)", refused[2])