summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/utils.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2018-11-12 17:00:22 (GMT)
committerGitHub <noreply@github.com>2018-11-12 17:00:22 (GMT)
commit74387926072abf338a4c1cec1bf0501fc65bbee5 (patch)
treea3328774e0b0ad8bbd256f0239b392dcd2952b3e /Lib/test/test_asyncio/utils.py
parent9404e7737bd09bc1df154e1216d721e5168e4c68 (diff)
downloadcpython-74387926072abf338a4c1cec1bf0501fc65bbee5.zip
cpython-74387926072abf338a4c1cec1bf0501fc65bbee5.tar.gz
cpython-74387926072abf338a4c1cec1bf0501fc65bbee5.tar.bz2
bpo-30064: Refactor sock_* asyncio API (#10419)
Diffstat (limited to 'Lib/test/test_asyncio/utils.py')
-rw-r--r--Lib/test/test_asyncio/utils.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index f7dcf93..b9489d7 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -180,11 +180,21 @@ class SSLWSGIServer(SSLWSGIServerMixin, SilentWSGIServer):
def _run_test_server(*, address, use_ssl=False, server_cls, server_ssl_cls):
+ def loop(environ):
+ size = int(environ['CONTENT_LENGTH'])
+ while size:
+ data = environ['wsgi.input'].read(min(size, 0x10000))
+ yield data
+ size -= len(data)
+
def app(environ, start_response):
status = '200 OK'
headers = [('Content-type', 'text/plain')]
start_response(status, headers)
- return [b'Test message']
+ if environ['PATH_INFO'] == '/loop':
+ return loop(environ)
+ else:
+ return [b'Test message']
# Run the test WSGI server in a separate thread in order not to
# interfere with event handling in the main thread