Skip to content

Commit 316e4e5

Browse files
committed
selector tests: drop the sleep, no longer required
also didn't work because auto-async-ification does not work in unittest classes
1 parent cc78f52 commit 316e4e5

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

tests/python/test_selector_events.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def test_write_to_self_exception(self):
184184
self.loop._csock.send.side_effect = RuntimeError()
185185
self.assertRaises(RuntimeError, self.loop._write_to_self)
186186

187-
async def test_sock_recv(self):
187+
def test_sock_recv(self):
188188
sock = test_utils.mock_nonblocking_socket()
189189
self.loop._sock_recv = mock.Mock()
190190

@@ -193,11 +193,10 @@ async def test_sock_recv(self):
193193
f = self.loop.create_task(f)
194194
else:
195195
self.assertEqual(type(f).__name__, asyncio.Future.__name__)
196-
await asyncio.sleep(0.01, loop=self.loop)
197196
if sys.version_info >= (3, 6, 4):
198197
self.loop._sock_recv.assert_called_with(f, None, sock, 1024)
199198

200-
async def test_sock_recv_reconnection(self):
199+
def test_sock_recv_reconnection(self):
201200
sock = mock.Mock()
202201
sock.fileno.return_value = 10
203202
sock.recv.side_effect = BlockingIOError
@@ -208,7 +207,6 @@ async def test_sock_recv_reconnection(self):
208207
fut = self.loop.sock_recv(sock, 1024)
209208
if sys.version_info >= (3, 7):
210209
fut = self.loop.create_task(fut)
211-
await asyncio.sleep(0.01, loop=self.loop)
212210
callback = self.loop.add_reader.call_args[0][1]
213211
params = self.loop.add_reader.call_args[0][2:]
214212

@@ -266,7 +264,7 @@ def test__sock_recv_exception(self):
266264
self.loop._sock_recv(f, None, sock, 1024)
267265
self.assertIs(err, f.exception())
268266

269-
async def test_sock_sendall(self):
267+
def test_sock_sendall(self):
270268
sock = test_utils.mock_nonblocking_socket()
271269
self.loop._sock_sendall = mock.Mock()
272270

@@ -275,10 +273,9 @@ async def test_sock_sendall(self):
275273
f = self.loop.create_task(f)
276274
else:
277275
self.assertEqual(type(f).__name__, asyncio.Future.__name__)
278-
await asyncio.sleep(0.01, loop=self.loop)
279276
self.assertEqual((f, None, sock, b'data'), self.loop._sock_sendall.call_args[0])
280277

281-
async def test_sock_sendall_nodata(self):
278+
def test_sock_sendall_nodata(self):
282279
sock = test_utils.mock_nonblocking_socket()
283280
self.loop._sock_sendall = mock.Mock()
284281

@@ -287,12 +284,11 @@ async def test_sock_sendall_nodata(self):
287284
f = self.loop.create_task(f)
288285
else:
289286
self.assertEqual(type(f).__name__, asyncio.Future.__name__)
290-
await asyncio.sleep(0.01, loop=self.loop)
291287
self.assertTrue(f.done())
292288
self.assertIsNone(f.result())
293289
self.assertFalse(self.loop._sock_sendall.called)
294290

295-
async def test_sock_sendall_reconnection(self):
291+
def test_sock_sendall_reconnection(self):
296292
sock = mock.Mock()
297293
sock.fileno.return_value = 10
298294
sock.send.side_effect = BlockingIOError
@@ -303,7 +299,6 @@ async def test_sock_sendall_reconnection(self):
303299
fut = self.loop.sock_sendall(sock, b'data')
304300
if sys.version_info >= (3, 7):
305301
fut = self.loop.create_task(fut)
306-
await asyncio.sleep(0.01, loop=self.loop)
307302
callback = self.loop.add_writer.call_args[0][1]
308303
params = self.loop.add_writer.call_args[0][2:]
309304

0 commit comments

Comments
 (0)