diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-12-17 00:51:09 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-12-17 00:51:09 (GMT) |
commit | 5f68ca66bf02c2bdd8dabb98041f62737862eb07 (patch) | |
tree | fc568112024dfc38bb80fa207540aaf46539e4a9 /Lib/test/test_asyncio/test_streams.py | |
parent | aa78adc589d85eb6b87d2083ae9cd3797fb7a3d2 (diff) | |
download | cpython-5f68ca66bf02c2bdd8dabb98041f62737862eb07.zip cpython-5f68ca66bf02c2bdd8dabb98041f62737862eb07.tar.gz cpython-5f68ca66bf02c2bdd8dabb98041f62737862eb07.tar.bz2 |
asyncio/tests: Fix some ResourceWarnings
Diffstat (limited to 'Lib/test/test_asyncio/test_streams.py')
-rw-r--r-- | Lib/test/test_asyncio/test_streams.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index 0a9762d..3b115b1 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -647,12 +647,13 @@ os.close(fd) 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): |