diff options
| author | Yury Selivanov <yury@magic.io> | 2016-11-04 18:30:41 (GMT) |
|---|---|---|
| committer | Yury Selivanov <yury@magic.io> | 2016-11-04 18:30:41 (GMT) |
| commit | a494e34ca1167667f6b53f34d1452f5621ee0e46 (patch) | |
| tree | 60d89ce8fd0f48b198b9edabd82f61f31093891d /Lib/test/test_asyncio/test_base_events.py | |
| parent | ca2d8be4ba3c0ab25fd42567df52300b560aadc5 (diff) | |
| parent | 69312fa4a2712b3ff37e473c833a42162aa9b5cd (diff) | |
| download | cpython-a494e34ca1167667f6b53f34d1452f5621ee0e46.zip cpython-a494e34ca1167667f6b53f34d1452f5621ee0e46.tar.gz cpython-a494e34ca1167667f6b53f34d1452f5621ee0e46.tar.bz2 | |
Merge 3.6 (issue #28613)
Diffstat (limited to 'Lib/test/test_asyncio/test_base_events.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_base_events.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py index 3913125..cdbd587 100644 --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -154,6 +154,7 @@ class BaseEventTests(test_utils.TestCase): class BaseEventLoopTests(test_utils.TestCase): def setUp(self): + super().setUp() self.loop = base_events.BaseEventLoop() self.loop._selector = mock.Mock() self.loop._selector.select.return_value = () @@ -976,6 +977,7 @@ class MyDatagramProto(asyncio.DatagramProtocol): class BaseEventLoopWithSelectorTests(test_utils.TestCase): def setUp(self): + super().setUp() self.loop = asyncio.new_event_loop() self.set_event_loop(self.loop) @@ -1692,5 +1694,23 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase): "took .* seconds$") +class RunningLoopTests(unittest.TestCase): + + def test_running_loop_within_a_loop(self): + @asyncio.coroutine + def runner(loop): + loop.run_forever() + + loop = asyncio.new_event_loop() + outer_loop = asyncio.new_event_loop() + try: + with self.assertRaisesRegex(RuntimeError, + 'while another loop is running'): + outer_loop.run_until_complete(runner(loop)) + finally: + loop.close() + outer_loop.close() + + if __name__ == '__main__': unittest.main() |
