summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/test_utils.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-12-17 00:31:55 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-12-17 00:31:55 (GMT)
commit1215227d1f2be84ec25f080bce2865f6e3134f80 (patch)
treeb0b8dd56b47b33443f7a3cb1efe077d66129f5c5 /Lib/asyncio/test_utils.py
parent5d120e952243af454efd0e4acba6619269352374 (diff)
parent631546cf929098acf254d9eee4d3da39c6ed3444 (diff)
downloadcpython-1215227d1f2be84ec25f080bce2865f6e3134f80.zip
cpython-1215227d1f2be84ec25f080bce2865f6e3134f80.tar.gz
cpython-1215227d1f2be84ec25f080bce2865f6e3134f80.tar.bz2
Merge 3.5
Diffstat (limited to 'Lib/asyncio/test_utils.py')
-rw-r--r--Lib/asyncio/test_utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py
index 8170533..396e6ae 100644
--- a/Lib/asyncio/test_utils.py
+++ b/Lib/asyncio/test_utils.py
@@ -446,9 +446,14 @@ def disable_logger():
finally:
logger.setLevel(old_level)
-def mock_nonblocking_socket():
+
+def mock_nonblocking_socket(proto=socket.IPPROTO_TCP, type=socket.SOCK_STREAM,
+ family=socket.AF_INET):
"""Create a mock of a non-blocking socket."""
- sock = mock.Mock(socket.socket)
+ sock = mock.MagicMock(socket.socket)
+ sock.proto = proto
+ sock.type = type
+ sock.family = family
sock.gettimeout.return_value = 0.0
return sock