[Python-checkins] cpython (merge 3.5 -> default): Merge 3.5
yury.selivanov
python-checkins at python.org
Wed Dec 16 19:51:37 EST 2015
https://hg.python.org/cpython/rev/a4c1b8e699d8
changeset: 99594:a4c1b8e699d8
parent: 99591:e54e1d02c5a2
parent: 99593:e94c278daa10
user: Yury Selivanov <yselivanov at sprymix.com>
date: Wed Dec 16 19:51:31 2015 -0500
summary:
Merge 3.5
files:
Lib/test/test_asyncio/test_base_events.py | 18 ++++++----
Lib/test/test_asyncio/test_streams.py | 13 ++++---
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -127,23 +127,27 @@
def test_check_resolved_address(self):
sock = socket.socket(socket.AF_INET)
- base_events._check_resolved_address(sock, ('1.2.3.4', 1))
+ with sock:
+ base_events._check_resolved_address(sock, ('1.2.3.4', 1))
sock = socket.socket(socket.AF_INET6)
- base_events._check_resolved_address(sock, ('::3', 1))
- base_events._check_resolved_address(sock, ('::3%lo0', 1))
- self.assertRaises(ValueError,
- base_events._check_resolved_address, sock, ('foo', 1))
+ with sock:
+ base_events._check_resolved_address(sock, ('::3', 1))
+ base_events._check_resolved_address(sock, ('::3%lo0', 1))
+ with self.assertRaises(ValueError):
+ base_events._check_resolved_address(sock, ('foo', 1))
def test_check_resolved_sock_type(self):
# Ensure we ignore extra flags in sock.type.
if hasattr(socket, 'SOCK_NONBLOCK'):
sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_NONBLOCK)
- base_events._check_resolved_address(sock, ('1.2.3.4', 1))
+ with sock:
+ base_events._check_resolved_address(sock, ('1.2.3.4', 1))
if hasattr(socket, 'SOCK_CLOEXEC'):
sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_CLOEXEC)
- base_events._check_resolved_address(sock, ('1.2.3.4', 1))
+ with sock:
+ base_events._check_resolved_address(sock, ('1.2.3.4', 1))
class BaseEventLoopTests(test_utils.TestCase):
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -647,12 +647,13 @@
def server():
# Runs in a separate thread.
sock = socket.socket()
- sock.bind(('localhost', 0))
- sock.listen(1)
- addr = sock.getsockname()
- q.put(addr)
- clt, _ = sock.accept()
- clt.close()
+ with sock:
+ sock.bind(('localhost', 0))
+ sock.listen(1)
+ addr = sock.getsockname()
+ q.put(addr)
+ clt, _ = sock.accept()
+ clt.close()
@asyncio.coroutine
def client(host, port):
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list