aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-15 00:04:21 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-15 00:04:21 +0100
commit29ad0111bd8c7edd049c964c66cfb9e9114c99d2 (patch)
tree9fee6570ed8b11b78e9159153a7d241e1c212e21 /Lib/test/test_asyncio/test_events.py
parentb92626df5ca72d25236404a0a62cf47279c4e503 (diff)
downloadcpython-29ad0111bd8c7edd049c964c66cfb9e9114c99d2.tar.gz
cpython-29ad0111bd8c7edd049c964c66cfb9e9114c99d2.zip
asyncio: sync with Tulip
* PipeHandle now uses None instead of -1 for a closed handle * Sort imports in windows_utils. * Fix test_events on Python older than 3.5. Skip SSL tests on the ProactorEventLoop if ssl.MemoryIO is missing * Fix BaseEventLoop._create_connection_transport(). Close the transport if the creation of the transport (if the waiter) gets an exception. * _ProactorBasePipeTransport now sets _sock to None when the transport is closed. * Fix BaseSubprocessTransport.close(). Ignore pipes for which the protocol is not set yet (still equal to None). * TestLoop.close() now calls the close() method of the parent class (BaseEventLoop). * Cleanup BaseSelectorEventLoop: create the protocol on a separated line for readability and ease debugging. * Fix BaseSubprocessTransport._kill_wait(). Set the _returncode attribute, so close() doesn't try to terminate the process. * Tests: explicitly close event loops and transports * UNIX pipe transports: add closed/closing in repr(). Add "closed" or "closing" state in the __repr__() method of _UnixReadPipeTransport and _UnixWritePipeTransport classes.
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r--Lib/test/test_asyncio/test_events.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index a2c6dc94c97..a38c90ebe8c 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -25,6 +25,7 @@ import weakref
import asyncio
from asyncio import proactor_events
from asyncio import selector_events
+from asyncio import sslproto
from asyncio import test_utils
try:
from test import support
@@ -1585,6 +1586,7 @@ class SubprocessTestsMixin:
self.assertTrue(all(f.done() for f in proto.disconnects.values()))
self.assertEqual(proto.data[1].rstrip(b'\r\n'), b'Python')
self.assertEqual(proto.data[2], b'')
+ transp.close()
def test_subprocess_exitcode(self):
connect = self.loop.subprocess_shell(
@@ -1594,6 +1596,7 @@ class SubprocessTestsMixin:
self.assertIsInstance(proto, MySubprocessProtocol)
self.loop.run_until_complete(proto.completed)
self.assertEqual(7, proto.returncode)
+ transp.close()
def test_subprocess_close_after_finish(self):
connect = self.loop.subprocess_shell(
@@ -1621,6 +1624,7 @@ class SubprocessTestsMixin:
transp.kill()
self.loop.run_until_complete(proto.completed)
self.check_killed(proto.returncode)
+ transp.close()
def test_subprocess_terminate(self):
prog = os.path.join(os.path.dirname(__file__), 'echo.py')
@@ -1635,6 +1639,7 @@ class SubprocessTestsMixin:
transp.terminate()
self.loop.run_until_complete(proto.completed)
self.check_terminated(proto.returncode)
+ transp.close()
@unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP")
def test_subprocess_send_signal(self):
@@ -1650,6 +1655,7 @@ class SubprocessTestsMixin:
transp.send_signal(signal.SIGHUP)
self.loop.run_until_complete(proto.completed)
self.assertEqual(-signal.SIGHUP, proto.returncode)
+ transp.close()
def test_subprocess_stderr(self):
prog = os.path.join(os.path.dirname(__file__), 'echo2.py')
@@ -1784,6 +1790,22 @@ if sys.platform == 'win32':
def create_event_loop(self):
return asyncio.ProactorEventLoop()
+ if not sslproto._is_sslproto_available():
+ def test_create_ssl_connection(self):
+ raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
+
+ def test_create_server_ssl(self):
+ raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
+
+ def test_create_server_ssl_verify_failed(self):
+ raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
+
+ def test_create_server_ssl_match_failed(self):
+ raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
+
+ def test_create_server_ssl_verified(self):
+ raise unittest.SkipTest("need python 3.5 (ssl.MemoryBIO)")
+
def test_legacy_create_ssl_connection(self):
raise unittest.SkipTest("IocpEventLoop incompatible with legacy SSL")