From 20378f61bf942e6fa7e0a197820884cdb9f746ae Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Thu, 2 May 2024 16:31:06 -0400 Subject: [PATCH] Get coverage up to 100% --- tests/test_ash.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_ash.py b/tests/test_ash.py index 4bc3f0e2..690e21a0 100644 --- a/tests/test_ash.py +++ b/tests/test_ash.py @@ -103,7 +103,7 @@ def write(self, data: bytes) -> None: class FakeTransportRandomLoss(FakeTransport): def write(self, data: bytes) -> None: - if random.random() < 0.25: + if random.random() < 0.20: return for byte in data: @@ -584,3 +584,8 @@ async def test_ash_end_to_end(transport_cls: type[FakeTransport]) -> None: host.send_reset() await asyncio.sleep(0.01) await host.send_data(b"test") + + # Trigger a failure caused by excessive NAKs + with patch.object(ncp, "nak_state", True): + with pytest.raises(ash.NotAcked): + await host.send_data(b"ncp NAKing until failure")