summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_base_events.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-12-17 00:51:09 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-12-17 00:51:09 (GMT)
commit5f68ca66bf02c2bdd8dabb98041f62737862eb07 (patch)
treefc568112024dfc38bb80fa207540aaf46539e4a9 /Lib/test/test_asyncio/test_base_events.py
parentaa78adc589d85eb6b87d2083ae9cd3797fb7a3d2 (diff)
downloadcpython-5f68ca66bf02c2bdd8dabb98041f62737862eb07.zip
cpython-5f68ca66bf02c2bdd8dabb98041f62737862eb07.tar.gz
cpython-5f68ca66bf02c2bdd8dabb98041f62737862eb07.tar.bz2
asyncio/tests: Fix some ResourceWarnings
Diffstat (limited to 'Lib/test/test_asyncio/test_base_events.py')
-rw-r--r--Lib/test/test_asyncio/test_base_events.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index a46ac16..0166660 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -127,23 +127,27 @@ class BaseEventTests(test_utils.TestCase):
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):