mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Update cherrypy-18.6.1
This commit is contained in:
parent
b3ae6bd695
commit
ebffd124f6
57 changed files with 1269 additions and 1509 deletions
|
@ -1,10 +1,7 @@
|
|||
import os
|
||||
import signal
|
||||
import time
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
from six.moves.http_client import BadStatusLine
|
||||
from http.client import BadStatusLine
|
||||
|
||||
import pytest
|
||||
import portend
|
||||
|
@ -13,6 +10,7 @@ import cherrypy
|
|||
import cherrypy.process.servers
|
||||
from cherrypy.test import helper
|
||||
|
||||
|
||||
engine = cherrypy.engine
|
||||
thisdir = os.path.join(os.getcwd(), os.path.dirname(__file__))
|
||||
|
||||
|
@ -433,41 +431,41 @@ test_case_name: "test_signal_handler_unsubscribe"
|
|||
)
|
||||
|
||||
|
||||
class WaitTests(unittest.TestCase):
|
||||
def test_safe_wait_INADDR_ANY(): # pylint: disable=invalid-name
|
||||
"""
|
||||
Wait on INADDR_ANY should not raise IOError
|
||||
|
||||
def test_safe_wait_INADDR_ANY(self):
|
||||
"""
|
||||
Wait on INADDR_ANY should not raise IOError
|
||||
In cases where the loopback interface does not exist, CherryPy cannot
|
||||
effectively determine if a port binding to INADDR_ANY was effected.
|
||||
In this situation, CherryPy should assume that it failed to detect
|
||||
the binding (not that the binding failed) and only warn that it could
|
||||
not verify it.
|
||||
"""
|
||||
# At such a time that CherryPy can reliably determine one or more
|
||||
# viable IP addresses of the host, this test may be removed.
|
||||
|
||||
In cases where the loopback interface does not exist, CherryPy cannot
|
||||
effectively determine if a port binding to INADDR_ANY was effected.
|
||||
In this situation, CherryPy should assume that it failed to detect
|
||||
the binding (not that the binding failed) and only warn that it could
|
||||
not verify it.
|
||||
"""
|
||||
# At such a time that CherryPy can reliably determine one or more
|
||||
# viable IP addresses of the host, this test may be removed.
|
||||
# Simulate the behavior we observe when no loopback interface is
|
||||
# present by: finding a port that's not occupied, then wait on it.
|
||||
|
||||
# Simulate the behavior we observe when no loopback interface is
|
||||
# present by: finding a port that's not occupied, then wait on it.
|
||||
free_port = portend.find_available_local_port()
|
||||
|
||||
free_port = portend.find_available_local_port()
|
||||
servers = cherrypy.process.servers
|
||||
|
||||
servers = cherrypy.process.servers
|
||||
inaddr_any = '0.0.0.0'
|
||||
|
||||
inaddr_any = '0.0.0.0'
|
||||
# Wait on the free port that's unbound
|
||||
with pytest.warns(
|
||||
UserWarning,
|
||||
match='Unable to verify that the server is bound on ',
|
||||
) as warnings:
|
||||
# pylint: disable=protected-access
|
||||
with servers._safe_wait(inaddr_any, free_port):
|
||||
portend.occupied(inaddr_any, free_port, timeout=1)
|
||||
assert len(warnings) == 1
|
||||
|
||||
# Wait on the free port that's unbound
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
with servers._safe_wait(inaddr_any, free_port):
|
||||
portend.occupied(inaddr_any, free_port, timeout=1)
|
||||
self.assertEqual(len(w), 1)
|
||||
self.assertTrue(isinstance(w[0], warnings.WarningMessage))
|
||||
self.assertTrue(
|
||||
'Unable to verify that the server is bound on ' in str(w[0]))
|
||||
|
||||
# The wait should still raise an IO error if INADDR_ANY was
|
||||
# not supplied.
|
||||
with pytest.raises(IOError):
|
||||
with servers._safe_wait('127.0.0.1', free_port):
|
||||
portend.occupied('127.0.0.1', free_port, timeout=1)
|
||||
# The wait should still raise an IO error if INADDR_ANY was
|
||||
# not supplied.
|
||||
with pytest.raises(IOError):
|
||||
# pylint: disable=protected-access
|
||||
with servers._safe_wait('127.0.0.1', free_port):
|
||||
portend.occupied('127.0.0.1', free_port, timeout=1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue