diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-30 15:31:53 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-30 15:31:53 +0200 |
commit | cfa8da5e9359cd83a324ae63ccaa192e0a17cca4 (patch) | |
tree | 961668a2fb92ba4c669219ef392b170663f37ed1 /asyncio/test_utils.py | |
parent | dd530fe9d73ddd41f0b125b2e6ad06731626aa34 (diff) | |
download | trollius-cfa8da5e9359cd83a324ae63ccaa192e0a17cca4.tar.gz |
Fix unit tests in debug mode: mock a non-blocking socket for socket operations
which now raise an exception if the socket is blocking.
Diffstat (limited to 'asyncio/test_utils.py')
-rw-r--r-- | asyncio/test_utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/asyncio/test_utils.py b/asyncio/test_utils.py index 840bbf9..ac7680d 100644 --- a/asyncio/test_utils.py +++ b/asyncio/test_utils.py @@ -417,3 +417,9 @@ def disable_logger(): yield finally: logger.setLevel(old_level) + +def mock_nonblocking_socket(): + """Create a mock of a non-blocking socket.""" + sock = mock.Mock(socket.socket) + sock.gettimeout.return_value = 0.0 + return sock |