summaryrefslogtreecommitdiffhomepage
path: root/test/python/threads
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2021-04-05 14:03:05 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2021-04-05 14:03:05 +0100
commit6c97a1a069f0ae8cf683c8364fb7f9dabc5e89cb (patch)
treea7eab02b6fc63ff8d1a1329a090162715371aa62 /test/python/threads
parent46d8567dd7c2a9af025f1de13084a9efd7118e20 (diff)
downloadunit-6c97a1a069f0ae8cf683c8364fb7f9dabc5e89cb.tar.gz
unit-6c97a1a069f0ae8cf683c8364fb7f9dabc5e89cb.tar.bz2
Tests: style.
Diffstat (limited to 'test/python/threads')
-rw-r--r--test/python/threads/asgi.py19
-rw-r--r--test/python/threads/wsgi.py14
2 files changed, 20 insertions, 13 deletions
diff --git a/test/python/threads/asgi.py b/test/python/threads/asgi.py
index d51ae431..ff4e52ad 100644
--- a/test/python/threads/asgi.py
+++ b/test/python/threads/asgi.py
@@ -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()),
+ ],
+ }
+ )
diff --git a/test/python/threads/wsgi.py b/test/python/threads/wsgi.py
index 1cc8ffe2..cc283cfe 100644
--- a/test/python/threads/wsgi.py
+++ b/test/python/threads/wsgi.py
@@ -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 []