mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 13:23:24 -07:00
Bump cheroot from 9.0.0 to 10.0.0 (#2128)
* Bump cheroot from 9.0.0 to 10.0.0 Bumps [cheroot](https://github.com/cherrypy/cheroot) from 9.0.0 to 10.0.0. - [Release notes](https://github.com/cherrypy/cheroot/releases) - [Changelog](https://github.com/cherrypy/cheroot/blob/main/CHANGES.rst) - [Commits](https://github.com/cherrypy/cheroot/compare/v9.0.0...v10.0.0) --- updated-dependencies: - dependency-name: cheroot dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Update cheroot==10.0.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
9423f65a90
commit
4033114175
19 changed files with 215 additions and 85 deletions
|
@ -4,11 +4,7 @@ Contains hooks, which are tightly bound to the Cheroot framework
|
|||
itself, useless for end-users' app testing.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
import six
|
||||
|
||||
|
||||
pytest_version = tuple(map(int, pytest.__version__.split('.')))
|
||||
|
@ -45,16 +41,3 @@ def pytest_load_initial_conftests(early_config, parser, args):
|
|||
'type=SocketKind.SOCK_STREAM, proto=.:'
|
||||
'pytest.PytestUnraisableExceptionWarning:_pytest.unraisableexception',
|
||||
))
|
||||
|
||||
if six.PY2:
|
||||
return
|
||||
|
||||
# NOTE: `ResourceWarning` does not exist under Python 2 and so using
|
||||
# NOTE: it in warning filters results in an `_OptionError` exception
|
||||
# NOTE: being raised.
|
||||
early_config._inicache['filterwarnings'].extend((
|
||||
# FIXME: Try to figure out what causes this and ensure that the socket
|
||||
# FIXME: gets closed.
|
||||
'ignore:unclosed <socket.socket fd=:ResourceWarning',
|
||||
'ignore:unclosed <ssl.SSLSocket fd=:ResourceWarning',
|
||||
))
|
||||
|
|
|
@ -1218,8 +1218,7 @@ def test_No_CRLF(test_client, invalid_terminator):
|
|||
# Initialize a persistent HTTP connection
|
||||
conn = test_client.get_connection()
|
||||
|
||||
# (b'%s' % b'') is not supported in Python 3.4, so just use bytes.join()
|
||||
conn.send(b''.join((b'GET /hello HTTP/1.1', invalid_terminator)))
|
||||
conn.send(b'GET /hello HTTP/1.1%s' % invalid_terminator)
|
||||
response = conn.response_class(conn.sock, method='GET')
|
||||
response.begin()
|
||||
actual_resp_body = response.read()
|
||||
|
|
|
@ -69,11 +69,7 @@ class HelloController(helper.Controller):
|
|||
|
||||
|
||||
def _get_http_response(connection, method='GET'):
|
||||
c = connection
|
||||
kwargs = {'strict': c.strict} if hasattr(c, 'strict') else {}
|
||||
# Python 3.2 removed the 'strict' feature, saying:
|
||||
# "http.client now always assumes HTTP/1.x compliant servers."
|
||||
return c.response_class(c.sock, method=method, **kwargs)
|
||||
return connection.response_class(connection.sock, method=method)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
|
||||
from cheroot import errors
|
||||
|
||||
from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS # noqa: WPS130
|
||||
from .._compat import IS_LINUX, IS_MACOS, IS_SOLARIS, IS_WINDOWS # noqa: WPS130
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -18,6 +18,7 @@ from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS # noqa: WPS130
|
|||
),
|
||||
(91, 11, 32) if IS_LINUX else
|
||||
(32, 35, 41) if IS_MACOS else
|
||||
(98, 11, 32) if IS_SOLARIS else
|
||||
(32, 10041, 11, 10035) if IS_WINDOWS else
|
||||
(),
|
||||
),
|
||||
|
|
|
@ -5,6 +5,7 @@ import queue
|
|||
import socket
|
||||
import tempfile
|
||||
import threading
|
||||
import types
|
||||
import uuid
|
||||
import urllib.parse # noqa: WPS301
|
||||
|
||||
|
@ -17,6 +18,7 @@ from pypytools.gc.custom import DefaultGc
|
|||
from .._compat import bton, ntob
|
||||
from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS, SYS_PLATFORM
|
||||
from ..server import IS_UID_GID_RESOLVABLE, Gateway, HTTPServer
|
||||
from ..workers.threadpool import ThreadPool
|
||||
from ..testing import (
|
||||
ANY_INTERFACE_IPV4,
|
||||
ANY_INTERFACE_IPV6,
|
||||
|
@ -254,6 +256,7 @@ def peercreds_enabled_server(http_server, unix_sock_file):
|
|||
|
||||
@unix_only_sock_test
|
||||
@non_macos_sock_test
|
||||
@pytest.mark.flaky(reruns=3, reruns_delay=2)
|
||||
def test_peercreds_unix_sock(http_request_timeout, peercreds_enabled_server):
|
||||
"""Check that ``PEERCRED`` lookup works when enabled."""
|
||||
httpserver = peercreds_enabled_server
|
||||
|
@ -370,6 +373,33 @@ def test_high_number_of_file_descriptors(native_server_client, resource_limit):
|
|||
assert any(fn >= resource_limit for fn in native_process_conn.filenos)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not hasattr(socket, 'SO_REUSEPORT'),
|
||||
reason='socket.SO_REUSEPORT is not supported on this platform',
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
'ip_addr',
|
||||
(
|
||||
ANY_INTERFACE_IPV4,
|
||||
ANY_INTERFACE_IPV6,
|
||||
),
|
||||
)
|
||||
def test_reuse_port(http_server, ip_addr, mocker):
|
||||
"""Check that port initialized externally can be reused."""
|
||||
family = socket.getaddrinfo(ip_addr, EPHEMERAL_PORT)[0][0]
|
||||
s = socket.socket(family)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
|
||||
s.bind((ip_addr, EPHEMERAL_PORT))
|
||||
server = HTTPServer(
|
||||
bind_addr=s.getsockname()[:2], gateway=Gateway, reuse_port=True,
|
||||
)
|
||||
spy = mocker.spy(server, 'prepare')
|
||||
server.prepare()
|
||||
server.stop()
|
||||
s.close()
|
||||
assert spy.spy_exception is None
|
||||
|
||||
|
||||
ISSUE511 = IS_MACOS
|
||||
|
||||
|
||||
|
@ -439,3 +469,90 @@ def many_open_sockets(request, resource_limit):
|
|||
# Close our open resources
|
||||
for test_socket in test_sockets:
|
||||
test_socket.close()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('minthreads', 'maxthreads', 'inited_maxthreads'),
|
||||
(
|
||||
(
|
||||
# NOTE: The docstring only mentions -1 to mean "no max", but other
|
||||
# NOTE: negative numbers should also work.
|
||||
1,
|
||||
-2,
|
||||
float('inf'),
|
||||
),
|
||||
(1, -1, float('inf')),
|
||||
(1, 1, 1),
|
||||
(1, 2, 2),
|
||||
(1, float('inf'), float('inf')),
|
||||
(2, -2, float('inf')),
|
||||
(2, -1, float('inf')),
|
||||
(2, 2, 2),
|
||||
(2, float('inf'), float('inf')),
|
||||
),
|
||||
)
|
||||
def test_threadpool_threadrange_set(minthreads, maxthreads, inited_maxthreads):
|
||||
"""Test setting the number of threads in a ThreadPool.
|
||||
|
||||
The ThreadPool should properly set the min+max number of the threads to use
|
||||
in the pool if those limits are valid.
|
||||
"""
|
||||
tp = ThreadPool(
|
||||
server=None,
|
||||
min=minthreads,
|
||||
max=maxthreads,
|
||||
)
|
||||
assert tp.min == minthreads
|
||||
assert tp.max == inited_maxthreads
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('minthreads', 'maxthreads', 'error'),
|
||||
(
|
||||
(-1, -1, 'min=-1 must be > 0'),
|
||||
(-1, 0, 'min=-1 must be > 0'),
|
||||
(-1, 1, 'min=-1 must be > 0'),
|
||||
(-1, 2, 'min=-1 must be > 0'),
|
||||
(0, -1, 'min=0 must be > 0'),
|
||||
(0, 0, 'min=0 must be > 0'),
|
||||
(0, 1, 'min=0 must be > 0'),
|
||||
(0, 2, 'min=0 must be > 0'),
|
||||
(1, 0, 'Expected an integer or the infinity value for the `max` argument but got 0.'),
|
||||
(1, 0.5, 'Expected an integer or the infinity value for the `max` argument but got 0.5.'),
|
||||
(2, 0, 'Expected an integer or the infinity value for the `max` argument but got 0.'),
|
||||
(2, '1', "Expected an integer or the infinity value for the `max` argument but got '1'."),
|
||||
(2, 1, 'max=1 must be > min=2'),
|
||||
),
|
||||
)
|
||||
def test_threadpool_invalid_threadrange(minthreads, maxthreads, error):
|
||||
"""Test that a ThreadPool rejects invalid min/max values.
|
||||
|
||||
The ThreadPool should raise an error with the proper message when
|
||||
initialized with an invalid min+max number of threads.
|
||||
"""
|
||||
with pytest.raises((ValueError, TypeError), match=error):
|
||||
ThreadPool(
|
||||
server=None,
|
||||
min=minthreads,
|
||||
max=maxthreads,
|
||||
)
|
||||
|
||||
|
||||
def test_threadpool_multistart_validation(monkeypatch):
|
||||
"""Test for ThreadPool multi-start behavior.
|
||||
|
||||
Tests that when calling start() on a ThreadPool multiple times raises a
|
||||
:exc:`RuntimeError`
|
||||
"""
|
||||
# replace _spawn_worker with a function that returns a placeholder to avoid
|
||||
# actually starting any threads
|
||||
monkeypatch.setattr(
|
||||
ThreadPool,
|
||||
'_spawn_worker',
|
||||
lambda _: types.SimpleNamespace(ready=True),
|
||||
)
|
||||
|
||||
tp = ThreadPool(server=None)
|
||||
tp.start()
|
||||
with pytest.raises(RuntimeError, match='Threadpools can only be started once.'):
|
||||
tp.start()
|
||||
|
|
|
@ -55,17 +55,6 @@ _stdlib_to_openssl_verify = {
|
|||
}
|
||||
|
||||
|
||||
fails_under_py3 = pytest.mark.xfail(
|
||||
reason='Fails under Python 3+',
|
||||
)
|
||||
|
||||
|
||||
fails_under_py3_in_pypy = pytest.mark.xfail(
|
||||
IS_PYPY,
|
||||
reason='Fails under PyPy3',
|
||||
)
|
||||
|
||||
|
||||
missing_ipv6 = pytest.mark.skipif(
|
||||
not _probe_ipv6_sock('::1'),
|
||||
reason=''
|
||||
|
@ -556,7 +545,6 @@ def test_ssl_env( # noqa: C901 # FIXME
|
|||
|
||||
# builtin ssl environment generation may use a loopback socket
|
||||
# ensure no ResourceWarning was raised during the test
|
||||
# NOTE: python 2.7 does not emit ResourceWarning for ssl sockets
|
||||
if IS_PYPY:
|
||||
# NOTE: PyPy doesn't have ResourceWarning
|
||||
# Ref: https://doc.pypy.org/en/latest/cpython_differences.html
|
||||
|
|
|
@ -463,16 +463,13 @@ def shb(response):
|
|||
return resp_status_line, response.getheaders(), response.read()
|
||||
|
||||
|
||||
# def openURL(*args, raise_subcls=(), **kwargs):
|
||||
# py27 compatible signature:
|
||||
def openURL(*args, **kwargs):
|
||||
def openURL(*args, raise_subcls=(), **kwargs):
|
||||
"""
|
||||
Open a URL, retrying when it fails.
|
||||
|
||||
Specify ``raise_subcls`` (class or tuple of classes) to exclude
|
||||
those socket.error subclasses from being suppressed and retried.
|
||||
"""
|
||||
raise_subcls = kwargs.pop('raise_subcls', ())
|
||||
opener = functools.partial(_open_url_once, *args, **kwargs)
|
||||
|
||||
def on_exception():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue