diff options
author | Yury Selivanov <yury@magic.io> | 2016-10-05 21:02:07 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-10-05 21:02:07 (GMT) |
commit | fb9c5186b6d4fcc6108db4678fb6cd815de496ce (patch) | |
tree | 69f5e7c09eabd4319a670e0a411f2d7e3eb2f9ab /Lib/test/test_asyncio/test_unix_events.py | |
parent | 3c946599d0828b7c4f5fe166d8a5a5cc1a2aa502 (diff) | |
parent | 67ea61818ef9b435bd47270e0a87e768ebdeeae6 (diff) | |
download | cpython-fb9c5186b6d4fcc6108db4678fb6cd815de496ce.zip cpython-fb9c5186b6d4fcc6108db4678fb6cd815de496ce.tar.gz cpython-fb9c5186b6d4fcc6108db4678fb6cd815de496ce.tar.bz2 |
Merge 3.6 (issue #28368)
Diffstat (limited to 'Lib/test/test_asyncio/test_unix_events.py')
-rw-r--r-- | Lib/test/test_asyncio/test_unix_events.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py index 570022f..088ef40 100644 --- a/Lib/test/test_asyncio/test_unix_events.py +++ b/Lib/test/test_asyncio/test_unix_events.py @@ -11,6 +11,7 @@ import sys import tempfile import threading import unittest +import warnings from unittest import mock if sys.platform == 'win32': @@ -1391,7 +1392,9 @@ class ChildWatcherTestsMixin: with mock.patch.object( old_loop, "remove_signal_handler") as m_remove_signal_handler: - self.watcher.attach_loop(None) + with self.assertWarnsRegex( + RuntimeWarning, 'A loop is being detached'): + self.watcher.attach_loop(None) m_remove_signal_handler.assert_called_once_with( signal.SIGCHLD) @@ -1463,6 +1466,15 @@ class ChildWatcherTestsMixin: if isinstance(self.watcher, asyncio.FastChildWatcher): self.assertFalse(self.watcher._zombies) + @waitpid_mocks + def test_add_child_handler_with_no_loop_attached(self, m): + callback = mock.Mock() + with self.create_watcher() as watcher: + with self.assertRaisesRegex( + RuntimeError, + 'the child watcher does not have a loop attached'): + watcher.add_child_handler(100, callback) + class SafeChildWatcherTests (ChildWatcherTestsMixin, test_utils.TestCase): def create_watcher(self): |