Tests: style.

This commit is contained in:
Andrei Zeliankou
2021-04-05 14:03:05 +01:00
parent 46d8567dd7
commit 6c97a1a069
67 changed files with 689 additions and 614 deletions

View File

@@ -2,6 +2,7 @@ import asyncio
import time
import threading
async def application(scope, receive, send):
assert scope['type'] == 'http'
@@ -17,11 +18,13 @@ async def application(scope, receive, send):
time.sleep(delay)
await send({
'type': 'http.response.start',
'status': 200,
'headers': [
(b'content-length', b'0'),
(b'x-thread', str(threading.currentThread().ident).encode()),
]
})
await send(
{
'type': 'http.response.start',
'status': 200,
'headers': [
(b'content-length', b'0'),
(b'x-thread', str(threading.currentThread().ident).encode()),
],
}
)

View File

@@ -1,15 +1,19 @@
import time
import threading
def application(environ, start_response):
delay = float(environ.get('HTTP_X_DELAY', 0))
time.sleep(delay)
start_response('200', [
('Content-Length', '0'),
('Wsgi-Multithread', str(environ['wsgi.multithread'])),
('X-Thread', str(threading.currentThread().ident))
])
start_response(
'200',
[
('Content-Length', '0'),
('Wsgi-Multithread', str(environ['wsgi.multithread'])),
('X-Thread', str(threading.currentThread().ident)),
],
)
return []