mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Bump cheroot from 8.5.2 to 8.6.0 (#1603)
* Bump cheroot from 8.5.2 to 8.6.0 Bumps [cheroot](https://github.com/cherrypy/cheroot) from 8.5.2 to 8.6.0. - [Release notes](https://github.com/cherrypy/cheroot/releases) - [Changelog](https://github.com/cherrypy/cheroot/blob/master/CHANGES.rst) - [Commits](https://github.com/cherrypy/cheroot/compare/v8.5.2...v8.6.0) --- updated-dependencies: - dependency-name: cheroot dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update cheroot==8.6.0 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
This commit is contained in:
parent
bb5ebe0fa5
commit
3689834051
30 changed files with 708 additions and 113 deletions
|
@ -1,6 +1,7 @@
|
|||
"""Test wsgi."""
|
||||
|
||||
from concurrent.futures.thread import ThreadPoolExecutor
|
||||
from traceback import print_tb
|
||||
|
||||
import pytest
|
||||
import portend
|
||||
|
@ -20,7 +21,7 @@ def simple_wsgi_server():
|
|||
"""Fucking simple wsgi server fixture (duh)."""
|
||||
port = portend.find_available_local_port()
|
||||
|
||||
def app(environ, start_response):
|
||||
def app(_environ, start_response):
|
||||
status = '200 OK'
|
||||
response_headers = [('Content-type', 'text/plain')]
|
||||
start_response(status, response_headers)
|
||||
|
@ -29,7 +30,9 @@ def simple_wsgi_server():
|
|||
host = '::'
|
||||
addr = host, port
|
||||
server = wsgi.Server(addr, app, timeout=600 if IS_SLOW_ENV else 20)
|
||||
# pylint: disable=possibly-unused-variable
|
||||
url = 'http://localhost:{port}/'.format(**locals())
|
||||
# pylint: disable=possibly-unused-variable
|
||||
with server._run_in_thread() as thread:
|
||||
yield locals()
|
||||
|
||||
|
@ -46,6 +49,7 @@ def test_connection_keepalive(simple_wsgi_server):
|
|||
with ExceptionTrap(requests.exceptions.ConnectionError) as trap:
|
||||
resp = session.get('info')
|
||||
resp.raise_for_status()
|
||||
print_tb(trap.tb)
|
||||
return bool(trap)
|
||||
|
||||
with ThreadPoolExecutor(max_workers=10 if IS_SLOW_ENV else 50) as pool:
|
||||
|
@ -56,3 +60,24 @@ def test_connection_keepalive(simple_wsgi_server):
|
|||
failures = sum(task.result() for task in tasks)
|
||||
|
||||
assert not failures
|
||||
|
||||
|
||||
def test_gateway_start_response_called_twice(monkeypatch):
|
||||
"""Verify that repeat calls of ``Gateway.start_response()`` fail."""
|
||||
monkeypatch.setattr(wsgi.Gateway, 'get_environ', lambda self: {})
|
||||
wsgi_gateway = wsgi.Gateway(None)
|
||||
wsgi_gateway.started_response = True
|
||||
|
||||
err_msg = '^WSGI start_response called a second time with no exc_info.$'
|
||||
with pytest.raises(RuntimeError, match=err_msg):
|
||||
wsgi_gateway.start_response('200', (), None)
|
||||
|
||||
|
||||
def test_gateway_write_needs_start_response_called_before(monkeypatch):
|
||||
"""Check that calling ``Gateway.write()`` needs started response."""
|
||||
monkeypatch.setattr(wsgi.Gateway, 'get_environ', lambda self: {})
|
||||
wsgi_gateway = wsgi.Gateway(None)
|
||||
|
||||
err_msg = '^WSGI write called before start_response.$'
|
||||
with pytest.raises(RuntimeError, match=err_msg):
|
||||
wsgi_gateway.write(None) # The actual arg value is unimportant
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue