Skip to content

Commit 55706b8

Browse files
committed
drop datagram write-error tests that pass without the fix
The from_callback variant only reaches the error path after the write has already been armed (and the protocol resumed), so it passes on main; fold the remaining scenario back into a single test.
1 parent b43d1fc commit 55706b8

1 file changed

Lines changed: 6 additions & 20 deletions

File tree

Lib/test/test_asyncio/test_events.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ def create_socket():
15831583
transport_1.close()
15841584
transport_2.close()
15851585

1586-
def _test_datagram_write_error_resumes_paused_protocol(self, first, second):
1586+
def test_datagram_write_error_resumes_paused_protocol(self):
15871587
# See https://github.com/python/cpython/issues/156698: a
15881588
# datagram write error must not strand data left in the write
15891589
# buffer, nor leave a paused protocol paused forever.
@@ -1619,11 +1619,11 @@ def error_received(self, exc):
16191619
# anything is left in the write buffer.
16201620
transport.set_write_buffer_limits(0)
16211621

1622-
# The first sendto() may arm an in-flight write, so the second
1623-
# one can end up queued behind it; queuing is what trips
1624-
# pause_writing() at a high water mark of 0.
1625-
transport.sendto(first, addr)
1626-
transport.sendto(second, addr)
1622+
# The oversized datagram fails while it is in flight, and the
1623+
# normal datagram behind it is left queued -- queuing is also
1624+
# what trips pause_writing() at a high water mark of 0.
1625+
transport.sendto(b'\x00' * 70000, addr)
1626+
transport.sendto(b'queued', addr)
16271627

16281628
loop.run_until_complete(
16291629
asyncio.wait_for(protocol.error_received_event,
@@ -1643,20 +1643,6 @@ def error_received(self, exc):
16431643
transport.close()
16441644
test_utils.run_briefly(loop)
16451645

1646-
def test_datagram_write_error_resumes_paused_protocol_in_flight(self):
1647-
# oversized datagram fails while in flight; a normal datagram
1648-
# queued right behind it must not be stranded.
1649-
oversized = b'\x00' * 70000
1650-
self._test_datagram_write_error_resumes_paused_protocol(
1651-
oversized, b'queued')
1652-
1653-
def test_datagram_write_error_resumes_paused_protocol_from_callback(self):
1654-
# oversized datagram fails once it reaches the front of the
1655-
# buffer; the protocol must not stay paused forever.
1656-
oversized = b'\x00' * 70000
1657-
self._test_datagram_write_error_resumes_paused_protocol(
1658-
b'ok', oversized)
1659-
16601646
def test_datagram_write_error_reentrant_sendto(self):
16611647
# See https://github.com/python/cpython/issues/156698: an
16621648
# error_received() callback that sends more data synchronously

0 commit comments

Comments
 (0)