Skip to content

Commit

Permalink
Make tests less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed May 2, 2024
1 parent 20378f6 commit 087d682
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_ash.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def write(self, data: bytes) -> None:
if random.random() < 0.20:
return

for byte in data:
super().write(bytes([byte]))
super().write(data)


class FakeTransportWithDelays(FakeTransport):
Expand Down Expand Up @@ -586,6 +585,9 @@ async def test_ash_end_to_end(transport_cls: type[FakeTransport]) -> None:
await host.send_data(b"test")

# Trigger a failure caused by excessive NAKs
ncp._t_rx_ack = ash.T_RX_ACK_INIT / 1000
host._t_rx_ack = ash.T_RX_ACK_INIT / 1000

with patch.object(ncp, "nak_state", True):
with pytest.raises(ash.NotAcked):
await host.send_data(b"ncp NAKing until failure")

0 comments on commit 087d682

Please sign in to comment.