bpo-23057: add loop self socket as wakeup fd for signals (#11135)

This commit is contained in:
Vladimir Matveev 2018-12-18 13:56:17 -08:00 committed by Andrew Svetlov
parent e3666fc8ef
commit b5c8cfa1da
6 changed files with 104 additions and 6 deletions

View file

@ -737,19 +737,19 @@ class BaseProactorEventLoopTests(test_utils.TestCase):
with mock.patch('asyncio.proactor_events.socket.socketpair',
return_value=(self.ssock, self.csock)):
self.loop = BaseProactorEventLoop(self.proactor)
with mock.patch('signal.set_wakeup_fd'):
self.loop = BaseProactorEventLoop(self.proactor)
self.set_event_loop(self.loop)
@mock.patch.object(BaseProactorEventLoop, 'call_soon')
@mock.patch('asyncio.proactor_events.socket.socketpair')
def test_ctor(self, socketpair, call_soon):
def test_ctor(self, socketpair):
ssock, csock = socketpair.return_value = (
mock.Mock(), mock.Mock())
loop = BaseProactorEventLoop(self.proactor)
with mock.patch('signal.set_wakeup_fd'):
loop = BaseProactorEventLoop(self.proactor)
self.assertIs(loop._ssock, ssock)
self.assertIs(loop._csock, csock)
self.assertEqual(loop._internal_fds, 1)
call_soon.assert_called_with(loop._loop_self_reading)
loop.close()
def test_close_self_pipe(self):