test_asgi_application.py (1730:44912af5b3e6) test_asgi_application.py (1736:22db875fda34)
1import re
2import time
3from distutils.version import LooseVersion
4
5import pytest
6
1import re
2import time
3from distutils.version import LooseVersion
4
5import pytest
6
7from conftest import skip_alert
8from unit.applications.lang.python import TestApplicationPython
9from unit.option import option
10
11
12class TestASGIApplication(TestApplicationPython):
13 prerequisites = {'modules': {'python':
14 lambda v: LooseVersion(v) >= LooseVersion('3.5')}}
15 load_module = 'asgi'

--- 340 unchanged lines hidden (view full) ---

356
357 time.sleep(0.5)
358
359 for _ in range(10):
360 self.get(headers=headers_delay_1, no_recv=True)
361
362 self.get(headers=headers_delay_1)
363
7from unit.applications.lang.python import TestApplicationPython
8from unit.option import option
9
10
11class TestASGIApplication(TestApplicationPython):
12 prerequisites = {'modules': {'python':
13 lambda v: LooseVersion(v) >= LooseVersion('3.5')}}
14 load_module = 'asgi'

--- 340 unchanged lines hidden (view full) ---

355
356 time.sleep(0.5)
357
358 for _ in range(10):
359 self.get(headers=headers_delay_1, no_recv=True)
360
361 self.get(headers=headers_delay_1)
362
364 def test_asgi_application_loading_error(self):
363 def test_asgi_application_loading_error(self, skip_alert):
365 skip_alert(r'Python failed to import module "blah"')
366
367 self.load('empty', module="blah")
368
369 assert self.get()['status'] == 503, 'loading error'
370
371 def test_asgi_application_threading(self):
372 """wait_for_record() timeouts after 5s while every thread works at

--- 74 unchanged lines hidden ---
364 skip_alert(r'Python failed to import module "blah"')
365
366 self.load('empty', module="blah")
367
368 assert self.get()['status'] == 503, 'loading error'
369
370 def test_asgi_application_threading(self):
371 """wait_for_record() timeouts after 5s while every thread works at

--- 74 unchanged lines hidden ---