Skip to content

Commit ebbe470

Browse files
committed
PYTHON-5781 Remove test_reads_data_in_multiple_chunks re-added by revert
1 parent 41794db commit ebbe470

2 files changed

Lines changed: 0 additions & 48 deletions

File tree

test/asynchronous/test_async_network_layer.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -155,31 +155,6 @@ async def test_close_with_exception_propagates_to_pending(self):
155155

156156

157157
class TestAsyncSocketReceive(AsyncUnitTest):
158-
async def test_reads_data_in_multiple_chunks(self):
159-
# Covers the loop in _async_socket_receive that accumulates short reads
160-
# until the requested length has been received.
161-
data = b"abcdefgh"
162-
length = len(data)
163-
chunk1, chunk2 = data[:4], data[4:]
164-
mock_socket = MagicMock()
165-
loop = asyncio.get_running_loop()
166-
calls = 0
167-
168-
async def fake_recv_into(sock, buf):
169-
nonlocal calls
170-
if calls == 0:
171-
buf[: len(chunk1)] = chunk1
172-
calls += 1
173-
return len(chunk1)
174-
buf[: len(chunk2)] = chunk2
175-
calls += 1
176-
return len(chunk2)
177-
178-
with patch.object(loop, "sock_recv_into", new=AsyncMock(side_effect=fake_recv_into)):
179-
result = await _async_socket_receive(mock_socket, length, loop)
180-
self.assertEqual(bytes(result), data)
181-
self.assertEqual(calls, 2)
182-
183158
async def test_raises_on_connection_closed(self):
184159
# Covers the explicit `raise OSError("connection closed")` branch when
185160
# sock_recv_into returns 0.

test/test_network_layer.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,29 +117,6 @@ def test_unknown_opcode_raises(self):
117117

118118

119119
class TestReceiveData(UnitTest):
120-
def test_reads_data_in_multiple_chunks(self):
121-
# Covers the loop in receive_data that accumulates short reads until the
122-
# requested length has been received.
123-
data = b"abcdefgh"
124-
chunk1, chunk2 = data[:4], data[4:]
125-
conn = _make_conn()
126-
calls = 0
127-
128-
def fake_recv_into(buf):
129-
nonlocal calls
130-
if calls == 0:
131-
buf[: len(chunk1)] = chunk1
132-
calls += 1
133-
return len(chunk1)
134-
buf[: len(chunk2)] = chunk2
135-
calls += 1
136-
return len(chunk2)
137-
138-
conn.conn.recv_into.side_effect = fake_recv_into
139-
result = network_layer.receive_data(conn, len(data), deadline=None)
140-
self.assertEqual(bytes(result), data)
141-
self.assertEqual(calls, 2)
142-
143120
def test_raises_on_connection_closed(self):
144121
# Covers the explicit `raise OSError("connection closed")` branch when
145122
# recv_into returns 0.

0 commit comments

Comments
 (0)