diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2014-12-26 21:07:52 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2014-12-26 21:07:52 +0100 |
| commit | 956de691f8bfc379a1f1453e9a53661c92afa15e (patch) | |
| tree | f4c53073127f3577386b8c728aa0fc08339e7b3f /Lib/test/test_asyncio/test_proactor_events.py | |
| parent | d7ff5a5375cc23dff10f91696ac4895971c5850c (diff) | |
| download | cpython-git-956de691f8bfc379a1f1453e9a53661c92afa15e.tar.gz | |
Issue #22926: In debug mode, call_soon(), call_at() and call_later() methods of
asyncio.BaseEventLoop now use the identifier of the current thread to ensure
that they are called from the thread running the event loop.
Before, the get_event_loop() method was used to check the thread, and no
exception was raised when the thread had no event loop. Now the methods always
raise an exception in debug mode when called from the wrong thread. It should
help to notice misusage of the API.
Diffstat (limited to 'Lib/test/test_asyncio/test_proactor_events.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_proactor_events.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py index 9e9b41a47f..825823834a 100644 --- a/Lib/test/test_asyncio/test_proactor_events.py +++ b/Lib/test/test_asyncio/test_proactor_events.py @@ -440,17 +440,16 @@ class BaseProactorEventLoopTests(test_utils.TestCase): self.loop = EventLoop(self.proactor) self.set_event_loop(self.loop, cleanup=False) - @mock.patch.object(BaseProactorEventLoop, '_call_soon') + @mock.patch.object(BaseProactorEventLoop, 'call_soon') @mock.patch.object(BaseProactorEventLoop, '_socketpair') - def test_ctor(self, socketpair, _call_soon): + def test_ctor(self, socketpair, call_soon): ssock, csock = socketpair.return_value = ( mock.Mock(), mock.Mock()) 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, (), - check_loop=False) + call_soon.assert_called_with(loop._loop_self_reading) def test_close_self_pipe(self): self.loop._close_self_pipe() |
