mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 05:13:21 -07:00
Bump cherrypy from 18.9.0 to 18.10.0 (#2353)
* Bump cherrypy from 18.9.0 to 18.10.0 Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.9.0 to 18.10.0. - [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst) - [Commits](https://github.com/cherrypy/cherrypy/compare/v18.9.0...v18.10.0) --- updated-dependencies: - dependency-name: cherrypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update cherrypy==18.10.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
5e977c044a
commit
a528f052b9
73 changed files with 1713 additions and 1008 deletions
|
@ -1,6 +1,4 @@
|
|||
"""
|
||||
Regression test suite for CherryPy.
|
||||
"""
|
||||
"""Regression test suite for CherryPy."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""Test module for the @-decorator syntax, which is version-specific"""
|
||||
"""Test module for the @-decorator syntax, which is version-specific."""
|
||||
|
||||
import cherrypy
|
||||
from cherrypy import expose, tools
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
"""CherryPy Benchmark Tool
|
||||
"""CherryPy Benchmark Tool.
|
||||
|
||||
Usage:
|
||||
benchmark.py [options]
|
||||
Usage:
|
||||
benchmark.py [options]
|
||||
|
||||
--null: use a null Request object (to bench the HTTP server only)
|
||||
--notests: start the server but do not run the tests; this allows
|
||||
you to check the tested pages with a browser
|
||||
--help: show this help message
|
||||
--cpmodpy: run tests via apache on 54583 (with the builtin _cpmodpy)
|
||||
--modpython: run tests via apache on 54583 (with modpython_gateway)
|
||||
--ab=path: Use the ab script/executable at 'path' (see below)
|
||||
--apache=path: Use the apache script/exe at 'path' (see below)
|
||||
--null: use a null Request object (to bench the HTTP server only)
|
||||
--notests: start the server but do not run the tests; this allows
|
||||
you to check the tested pages with a browser
|
||||
--help: show this help message
|
||||
--cpmodpy: run tests via apache on 54583 (with the builtin _cpmodpy)
|
||||
--modpython: run tests via apache on 54583 (with modpython_gateway)
|
||||
--ab=path: Use the ab script/executable at 'path' (see below)
|
||||
--apache=path: Use the apache script/exe at 'path' (see below)
|
||||
|
||||
To run the benchmarks, the Apache Benchmark tool "ab" must either be on
|
||||
your system path, or specified via the --ab=path option.
|
||||
To run the benchmarks, the Apache Benchmark tool "ab" must either be on
|
||||
your system path, or specified via the --ab=path option.
|
||||
|
||||
To run the modpython tests, the "apache" executable or script must be
|
||||
on your system path, or provided via the --apache=path option. On some
|
||||
platforms, "apache" may be called "apachectl" or "apache2ctl"--create
|
||||
a symlink to them if needed.
|
||||
To run the modpython tests, the "apache" executable or script must be
|
||||
on your system path, or provided via the --apache=path option. On some
|
||||
platforms, "apache" may be called "apachectl" or "apache2ctl"--create
|
||||
a symlink to them if needed.
|
||||
"""
|
||||
|
||||
import getopt
|
||||
|
@ -106,7 +106,6 @@ def init():
|
|||
|
||||
|
||||
class NullRequest:
|
||||
|
||||
"""A null HTTP request class, returning 200 and an empty body."""
|
||||
|
||||
def __init__(self, local, remote, scheme='http'):
|
||||
|
@ -131,65 +130,66 @@ class NullResponse:
|
|||
|
||||
|
||||
class ABSession:
|
||||
|
||||
"""A session of 'ab', the Apache HTTP server benchmarking tool.
|
||||
|
||||
Example output from ab:
|
||||
Example output from ab:
|
||||
|
||||
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.1 $> apache-2.0
|
||||
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
|
||||
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
|
||||
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.121.2.1 $> apache-2.0
|
||||
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd,
|
||||
http://www.zeustech.net/
|
||||
Copyright (c) 1998-2002 The Apache Software Foundation,
|
||||
http://www.apache.org/
|
||||
|
||||
Benchmarking 127.0.0.1 (be patient)
|
||||
Completed 100 requests
|
||||
Completed 200 requests
|
||||
Completed 300 requests
|
||||
Completed 400 requests
|
||||
Completed 500 requests
|
||||
Completed 600 requests
|
||||
Completed 700 requests
|
||||
Completed 800 requests
|
||||
Completed 900 requests
|
||||
Benchmarking 127.0.0.1 (be patient)
|
||||
Completed 100 requests
|
||||
Completed 200 requests
|
||||
Completed 300 requests
|
||||
Completed 400 requests
|
||||
Completed 500 requests
|
||||
Completed 600 requests
|
||||
Completed 700 requests
|
||||
Completed 800 requests
|
||||
Completed 900 requests
|
||||
|
||||
|
||||
Server Software: CherryPy/3.1beta
|
||||
Server Hostname: 127.0.0.1
|
||||
Server Port: 54583
|
||||
Server Software: CherryPy/3.1beta
|
||||
Server Hostname: 127.0.0.1
|
||||
Server Port: 54583
|
||||
|
||||
Document Path: /static/index.html
|
||||
Document Length: 14 bytes
|
||||
Document Path: /static/index.html
|
||||
Document Length: 14 bytes
|
||||
|
||||
Concurrency Level: 10
|
||||
Time taken for tests: 9.643867 seconds
|
||||
Complete requests: 1000
|
||||
Failed requests: 0
|
||||
Write errors: 0
|
||||
Total transferred: 189000 bytes
|
||||
HTML transferred: 14000 bytes
|
||||
Requests per second: 103.69 [#/sec] (mean)
|
||||
Time per request: 96.439 [ms] (mean)
|
||||
Time per request: 9.644 [ms] (mean, across all concurrent requests)
|
||||
Transfer rate: 19.08 [Kbytes/sec] received
|
||||
Concurrency Level: 10
|
||||
Time taken for tests: 9.643867 seconds
|
||||
Complete requests: 1000
|
||||
Failed requests: 0
|
||||
Write errors: 0
|
||||
Total transferred: 189000 bytes
|
||||
HTML transferred: 14000 bytes
|
||||
Requests per second: 103.69 [#/sec] (mean)
|
||||
Time per request: 96.439 [ms] (mean)
|
||||
Time per request: 9.644 [ms] (mean, across all concurrent requests)
|
||||
Transfer rate: 19.08 [Kbytes/sec] received
|
||||
|
||||
Connection Times (ms)
|
||||
min mean[+/-sd] median max
|
||||
Connect: 0 0 2.9 0 10
|
||||
Processing: 20 94 7.3 90 130
|
||||
Waiting: 0 43 28.1 40 100
|
||||
Total: 20 95 7.3 100 130
|
||||
Connection Times (ms)
|
||||
min mean[+/-sd] median max
|
||||
Connect: 0 0 2.9 0 10
|
||||
Processing: 20 94 7.3 90 130
|
||||
Waiting: 0 43 28.1 40 100
|
||||
Total: 20 95 7.3 100 130
|
||||
|
||||
Percentage of the requests served within a certain time (ms)
|
||||
50% 100
|
||||
66% 100
|
||||
75% 100
|
||||
80% 100
|
||||
90% 100
|
||||
95% 100
|
||||
98% 100
|
||||
99% 110
|
||||
100% 130 (longest request)
|
||||
Finished 1000 requests
|
||||
"""
|
||||
Percentage of the requests served within a certain time (ms)
|
||||
50% 100
|
||||
66% 100
|
||||
75% 100
|
||||
80% 100
|
||||
90% 100
|
||||
95% 100
|
||||
98% 100
|
||||
99% 110
|
||||
100% 130 (longest request)
|
||||
Finished 1000 requests
|
||||
"""
|
||||
|
||||
parse_patterns = [
|
||||
('complete_requests', 'Completed',
|
||||
|
@ -403,7 +403,6 @@ if __name__ == '__main__':
|
|||
print('Starting CherryPy app server...')
|
||||
|
||||
class NullWriter(object):
|
||||
|
||||
"""Suppresses the printing of socket errors."""
|
||||
|
||||
def write(self, data):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Demonstration app for cherrypy.checker.
|
||||
|
||||
This application is intentionally broken and badly designed.
|
||||
To demonstrate the output of the CherryPy Checker, simply execute
|
||||
this module.
|
||||
This application is intentionally broken and badly designed. To
|
||||
demonstrate the output of the CherryPy Checker, simply execute this
|
||||
module.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
|
|
@ -28,7 +28,6 @@ serverpem = os.path.join(os.getcwd(), thisdir, 'test.pem')
|
|||
|
||||
|
||||
class Supervisor(object):
|
||||
|
||||
"""Base class for modeling and controlling servers during testing."""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
@ -43,14 +42,13 @@ def log_to_stderr(msg, level):
|
|||
|
||||
|
||||
class LocalSupervisor(Supervisor):
|
||||
|
||||
"""Base class for modeling/controlling servers which run in the same
|
||||
process.
|
||||
|
||||
When the server side runs in a different process, start/stop can dump all
|
||||
state between each test module easily. When the server side runs in the
|
||||
same process as the client, however, we have to do a bit more work to
|
||||
ensure config and mounted apps are reset between tests.
|
||||
When the server side runs in a different process, start/stop can
|
||||
dump all state between each test module easily. When the server side
|
||||
runs in the same process as the client, however, we have to do a bit
|
||||
more work to ensure config and mounted apps are reset between tests.
|
||||
"""
|
||||
|
||||
using_apache = False
|
||||
|
@ -99,7 +97,6 @@ class LocalSupervisor(Supervisor):
|
|||
|
||||
|
||||
class NativeServerSupervisor(LocalSupervisor):
|
||||
|
||||
"""Server supervisor for the builtin HTTP server."""
|
||||
|
||||
httpserver_class = 'cherrypy._cpnative_server.CPHTTPServer'
|
||||
|
@ -111,7 +108,6 @@ class NativeServerSupervisor(LocalSupervisor):
|
|||
|
||||
|
||||
class LocalWSGISupervisor(LocalSupervisor):
|
||||
|
||||
"""Server supervisor for the builtin WSGI server."""
|
||||
|
||||
httpserver_class = 'cherrypy._cpwsgi_server.CPWSGIServer'
|
||||
|
@ -311,8 +307,7 @@ class CPWebCase(webtest.WebCase):
|
|||
sys.exit()
|
||||
|
||||
def getPage(self, url, *args, **kwargs):
|
||||
"""Open the url.
|
||||
"""
|
||||
"""Open the url."""
|
||||
if self.script_name:
|
||||
url = httputil.urljoin(self.script_name, url)
|
||||
return webtest.WebCase.getPage(self, url, *args, **kwargs)
|
||||
|
@ -323,8 +318,9 @@ class CPWebCase(webtest.WebCase):
|
|||
def assertErrorPage(self, status, message=None, pattern=''):
|
||||
"""Compare the response body with a built in error page.
|
||||
|
||||
The function will optionally look for the regexp pattern,
|
||||
within the exception embedded in the error page."""
|
||||
The function will optionally look for the regexp pattern, within
|
||||
the exception embedded in the error page.
|
||||
"""
|
||||
|
||||
# This will never contain a traceback
|
||||
page = cherrypy._cperror.get_error_page(status, message=message)
|
||||
|
@ -453,19 +449,17 @@ server.ssl_private_key: r'%s'
|
|||
'-c', self.config_file,
|
||||
'-p', self.pid_file,
|
||||
]
|
||||
r"""
|
||||
Command for running cherryd server with autoreload enabled
|
||||
r"""Command for running cherryd server with autoreload enabled.
|
||||
|
||||
Using
|
||||
|
||||
```
|
||||
['-c',
|
||||
"__requires__ = 'CherryPy'; \
|
||||
import pkg_resources, re, sys; \
|
||||
import importlib.metadata, re, sys; \
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]); \
|
||||
sys.exit(\
|
||||
pkg_resources.load_entry_point(\
|
||||
'CherryPy', 'console_scripts', 'cherryd')())"]
|
||||
importlib.metadata.distribution('cherrypy').entry_points[0])"]
|
||||
```
|
||||
|
||||
doesn't work as it's impossible to reconstruct the `-c`'s contents.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""logtest, a unittest.TestCase helper for testing log output."""
|
||||
"""Logtest, a unittest.TestCase helper for testing log output."""
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
@ -32,7 +32,6 @@ except ImportError:
|
|||
|
||||
|
||||
class LogCase(object):
|
||||
|
||||
"""unittest.TestCase mixin for testing log messages.
|
||||
|
||||
logfile: a filename for the desired log. Yes, I know modes are evil,
|
||||
|
@ -116,7 +115,8 @@ class LogCase(object):
|
|||
"""Return lines from self.logfile in the marked region.
|
||||
|
||||
If marker is None, self.lastmarker is used. If the log hasn't
|
||||
been marked (using self.markLog), the entire log will be returned.
|
||||
been marked (using self.markLog), the entire log will be
|
||||
returned.
|
||||
"""
|
||||
# Give the logger time to finish writing?
|
||||
# time.sleep(0.5)
|
||||
|
@ -146,9 +146,10 @@ class LogCase(object):
|
|||
def assertInLog(self, line, marker=None):
|
||||
"""Fail if the given (partial) line is not in the log.
|
||||
|
||||
The log will be searched from the given marker to the next marker.
|
||||
If marker is None, self.lastmarker is used. If the log hasn't
|
||||
been marked (using self.markLog), the entire log will be searched.
|
||||
The log will be searched from the given marker to the next
|
||||
marker. If marker is None, self.lastmarker is used. If the log
|
||||
hasn't been marked (using self.markLog), the entire log will be
|
||||
searched.
|
||||
"""
|
||||
data = self._read_marked_region(marker)
|
||||
for logline in data:
|
||||
|
@ -160,9 +161,10 @@ class LogCase(object):
|
|||
def assertNotInLog(self, line, marker=None):
|
||||
"""Fail if the given (partial) line is in the log.
|
||||
|
||||
The log will be searched from the given marker to the next marker.
|
||||
If marker is None, self.lastmarker is used. If the log hasn't
|
||||
been marked (using self.markLog), the entire log will be searched.
|
||||
The log will be searched from the given marker to the next
|
||||
marker. If marker is None, self.lastmarker is used. If the log
|
||||
hasn't been marked (using self.markLog), the entire log will be
|
||||
searched.
|
||||
"""
|
||||
data = self._read_marked_region(marker)
|
||||
for logline in data:
|
||||
|
@ -173,9 +175,10 @@ class LogCase(object):
|
|||
def assertValidUUIDv4(self, marker=None):
|
||||
"""Fail if the given UUIDv4 is not valid.
|
||||
|
||||
The log will be searched from the given marker to the next marker.
|
||||
If marker is None, self.lastmarker is used. If the log hasn't
|
||||
been marked (using self.markLog), the entire log will be searched.
|
||||
The log will be searched from the given marker to the next
|
||||
marker. If marker is None, self.lastmarker is used. If the log
|
||||
hasn't been marked (using self.markLog), the entire log will be
|
||||
searched.
|
||||
"""
|
||||
data = self._read_marked_region(marker)
|
||||
data = [
|
||||
|
@ -200,9 +203,10 @@ class LogCase(object):
|
|||
def assertLog(self, sliceargs, lines, marker=None):
|
||||
"""Fail if log.readlines()[sliceargs] is not contained in 'lines'.
|
||||
|
||||
The log will be searched from the given marker to the next marker.
|
||||
If marker is None, self.lastmarker is used. If the log hasn't
|
||||
been marked (using self.markLog), the entire log will be searched.
|
||||
The log will be searched from the given marker to the next
|
||||
marker. If marker is None, self.lastmarker is used. If the log
|
||||
hasn't been marked (using self.markLog), the entire log will be
|
||||
searched.
|
||||
"""
|
||||
data = self._read_marked_region(marker)
|
||||
if isinstance(sliceargs, int):
|
||||
|
|
|
@ -94,7 +94,6 @@ SetEnv testmod %(testmod)s
|
|||
|
||||
|
||||
class ModWSGISupervisor(helper.Supervisor):
|
||||
|
||||
"""Server Controller for ModWSGI and CherryPy."""
|
||||
|
||||
using_apache = True
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import calendar
|
||||
from datetime import datetime
|
||||
from datetime import timezone as _timezone
|
||||
import sys
|
||||
|
||||
import cherrypy
|
||||
|
@ -123,9 +124,12 @@ class Root(object):
|
|||
'reqcookie': cherrypy.request.cookie.output(),
|
||||
'sessiondata': list(cherrypy.session.items()),
|
||||
'servertime': (
|
||||
datetime.utcnow().strftime('%Y/%m/%d %H:%M') + ' UTC'
|
||||
datetime.now(_timezone.utc).strftime('%Y/%m/%d %H:%M UTC')
|
||||
),
|
||||
'serverunixtime':
|
||||
calendar.timegm(
|
||||
datetime.utcnow(_timezone.utc).timetuple(),
|
||||
),
|
||||
'serverunixtime': calendar.timegm(datetime.utcnow().timetuple()),
|
||||
'cpversion': cherrypy.__version__,
|
||||
'pyversion': sys.version,
|
||||
'expires': expires,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# coding: utf-8
|
||||
|
||||
"""Basic tests for the CherryPy core: request handling."""
|
||||
|
||||
import os
|
||||
|
@ -48,7 +47,6 @@ class CoreRequestHandlingTest(helper.CPWebCase):
|
|||
root.expose_dec = ExposeExamples()
|
||||
|
||||
class TestType(type):
|
||||
|
||||
"""Metaclass which automatically exposes all functions in each
|
||||
subclass, and adds an instance of the subclass as an attribute
|
||||
of root.
|
||||
|
|
|
@ -97,9 +97,7 @@ def setup_server():
|
|||
class UserContainerNode(object):
|
||||
|
||||
def POST(self, name):
|
||||
"""
|
||||
Allow the creation of a new Object
|
||||
"""
|
||||
"""Allow the creation of a new Object."""
|
||||
return 'POST %d' % make_user(name)
|
||||
|
||||
def GET(self):
|
||||
|
@ -125,15 +123,11 @@ def setup_server():
|
|||
raise cherrypy.HTTPError(404)
|
||||
|
||||
def GET(self, *args, **kwargs):
|
||||
"""
|
||||
Return the appropriate representation of the instance.
|
||||
"""
|
||||
"""Return the appropriate representation of the instance."""
|
||||
return str(self.user)
|
||||
|
||||
def POST(self, name):
|
||||
"""
|
||||
Update the fields of the user instance.
|
||||
"""
|
||||
"""Update the fields of the user instance."""
|
||||
self.user.name = name
|
||||
return 'POST %d' % self.user.id
|
||||
|
||||
|
@ -151,9 +145,7 @@ def setup_server():
|
|||
return 'PUT %d' % make_user(name, self.id)
|
||||
|
||||
def DELETE(self):
|
||||
"""
|
||||
Delete the user specified at the id.
|
||||
"""
|
||||
"""Delete the user specified at the id."""
|
||||
id = self.user.id
|
||||
del user_lookup[self.user.id]
|
||||
del self.user
|
||||
|
@ -199,7 +191,6 @@ def setup_server():
|
|||
return 'IndexOnly index'
|
||||
|
||||
class DecoratedPopArgs:
|
||||
|
||||
"""Test _cp_dispatch with @cherrypy.popargs."""
|
||||
|
||||
@cherrypy.expose
|
||||
|
@ -213,7 +204,6 @@ def setup_server():
|
|||
'a', 'b', handler=ABHandler())(DecoratedPopArgs)
|
||||
|
||||
class NonDecoratedPopArgs:
|
||||
|
||||
"""Test _cp_dispatch = cherrypy.popargs()"""
|
||||
|
||||
_cp_dispatch = cherrypy.popargs('a')
|
||||
|
@ -223,8 +213,7 @@ def setup_server():
|
|||
return 'index: ' + str(a)
|
||||
|
||||
class ParameterizedHandler:
|
||||
|
||||
"""Special handler created for each request"""
|
||||
"""Special handler created for each request."""
|
||||
|
||||
def __init__(self, a):
|
||||
self.a = a
|
||||
|
@ -238,8 +227,7 @@ def setup_server():
|
|||
return self.a
|
||||
|
||||
class ParameterizedPopArgs:
|
||||
|
||||
"""Test cherrypy.popargs() with a function call handler"""
|
||||
"""Test cherrypy.popargs() with a function call handler."""
|
||||
ParameterizedPopArgs = cherrypy.popargs(
|
||||
'a', handler=ParameterizedHandler)(ParameterizedPopArgs)
|
||||
|
||||
|
|
|
@ -16,9 +16,7 @@ from cherrypy.test import helper
|
|||
|
||||
|
||||
def is_ascii(text):
|
||||
"""
|
||||
Return True if the text encodes as ascii.
|
||||
"""
|
||||
"""Return True if the text encodes as ascii."""
|
||||
try:
|
||||
text.encode('ascii')
|
||||
return True
|
||||
|
@ -28,9 +26,9 @@ def is_ascii(text):
|
|||
|
||||
|
||||
def encode_filename(filename):
|
||||
"""
|
||||
Given a filename to be used in a multipart/form-data,
|
||||
encode the name. Return the key and encoded filename.
|
||||
"""Given a filename to be used in a multipart/form-data, encode the name.
|
||||
|
||||
Return the key and encoded filename.
|
||||
"""
|
||||
if is_ascii(filename):
|
||||
return 'filename', '"{filename}"'.format(**locals())
|
||||
|
@ -114,7 +112,7 @@ class HTTPTests(helper.CPWebCase):
|
|||
|
||||
@cherrypy.expose
|
||||
def post_filename(self, myfile):
|
||||
'''Return the name of the file which was uploaded.'''
|
||||
"""Return the name of the file which was uploaded."""
|
||||
return myfile.filename
|
||||
|
||||
cherrypy.tree.mount(Root())
|
||||
|
|
|
@ -199,7 +199,7 @@ def test_custom_log_format(log_tracker, monkeypatch, server):
|
|||
|
||||
|
||||
def test_utc_in_timez(monkeypatch):
|
||||
"""Test that ``LazyRfc3339UtcTime`` is rendered as ``str`` using UTC timestamp."""
|
||||
"""Test ``LazyRfc3339UtcTime`` renders as ``str`` UTC timestamp."""
|
||||
utcoffset8_local_time_in_naive_utc = (
|
||||
datetime.datetime(
|
||||
year=2020,
|
||||
|
@ -216,7 +216,7 @@ def test_utc_in_timez(monkeypatch):
|
|||
|
||||
class mock_datetime:
|
||||
@classmethod
|
||||
def utcnow(cls):
|
||||
def now(cls, tz):
|
||||
return utcoffset8_local_time_in_naive_utc
|
||||
|
||||
monkeypatch.setattr('datetime.datetime', mock_datetime)
|
||||
|
|
|
@ -6,8 +6,7 @@ __metaclass__ = type
|
|||
|
||||
class TestAutoreloader:
|
||||
def test_file_for_file_module_when_None(self):
|
||||
"""No error when module.__file__ is None.
|
||||
"""
|
||||
"""No error when ``module.__file__`` is :py:data:`None`."""
|
||||
class test_module:
|
||||
__file__ = None
|
||||
|
||||
|
|
|
@ -275,7 +275,6 @@ class RequestObjectTests(helper.CPWebCase):
|
|||
return 'success'
|
||||
|
||||
class Divorce(Test):
|
||||
|
||||
"""HTTP Method handlers shouldn't collide with normal method names.
|
||||
For example, a GET-handler shouldn't collide with a method named
|
||||
'get'.
|
||||
|
@ -757,8 +756,8 @@ class RequestObjectTests(helper.CPWebCase):
|
|||
self.assertBody('application/json')
|
||||
|
||||
def test_dangerous_host(self):
|
||||
"""
|
||||
Dangerous characters like newlines should be elided.
|
||||
"""Dangerous characters like newlines should be elided.
|
||||
|
||||
Ref #1974.
|
||||
"""
|
||||
# foo\nbar
|
||||
|
|
|
@ -4,7 +4,7 @@ import threading
|
|||
import time
|
||||
from http.client import HTTPConnection
|
||||
|
||||
from distutils.spawn import find_executable
|
||||
from shutil import which
|
||||
import pytest
|
||||
from path import Path
|
||||
from more_itertools import consume
|
||||
|
@ -146,9 +146,14 @@ class SessionTest(helper.CPWebCase):
|
|||
def teardown_class(cls):
|
||||
"""Clean up sessions."""
|
||||
super(cls, cls).teardown_class()
|
||||
try:
|
||||
files_to_clean = localDir.iterdir() # Python 3.8+
|
||||
except AttributeError:
|
||||
files_to_clean = localDir.listdir() # Python 3.6-3.7
|
||||
|
||||
consume(
|
||||
file.remove_p()
|
||||
for file in localDir.listdir()
|
||||
for file in files_to_clean
|
||||
if file.basename().startswith(
|
||||
sessions.FileSession.SESSION_PREFIX
|
||||
)
|
||||
|
@ -402,7 +407,7 @@ class SessionTest(helper.CPWebCase):
|
|||
|
||||
|
||||
def is_memcached_present():
|
||||
executable = find_executable('memcached')
|
||||
executable = which('memcached')
|
||||
return bool(executable)
|
||||
|
||||
|
||||
|
@ -418,9 +423,7 @@ def memcached_client_present():
|
|||
|
||||
@pytest.fixture(scope='session')
|
||||
def memcached_instance(request, watcher_getter, memcached_server_present):
|
||||
"""
|
||||
Start up an instance of memcached.
|
||||
"""
|
||||
"""Start up an instance of memcached."""
|
||||
|
||||
port = portend.find_available_local_port()
|
||||
|
||||
|
|
|
@ -433,14 +433,13 @@ test_case_name: "test_signal_handler_unsubscribe"
|
|||
|
||||
|
||||
def test_safe_wait_INADDR_ANY(): # pylint: disable=invalid-name
|
||||
"""
|
||||
Wait on INADDR_ANY should not raise IOError
|
||||
"""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.
|
||||
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.
|
||||
|
|
|
@ -460,9 +460,7 @@ class SessionAuthTest(unittest.TestCase):
|
|||
|
||||
class TestHooks:
|
||||
def test_priorities(self):
|
||||
"""
|
||||
Hooks should sort by priority order.
|
||||
"""
|
||||
"""Hooks should sort by priority order."""
|
||||
Hook = cherrypy._cprequest.Hook
|
||||
hooks = [
|
||||
Hook(None, priority=48),
|
||||
|
|
|
@ -9,18 +9,14 @@ class TutorialTest(helper.CPWebCase):
|
|||
|
||||
@classmethod
|
||||
def setup_server(cls):
|
||||
"""
|
||||
Mount something so the engine starts.
|
||||
"""
|
||||
"""Mount something so the engine starts."""
|
||||
class Dummy:
|
||||
pass
|
||||
cherrypy.tree.mount(Dummy())
|
||||
|
||||
@staticmethod
|
||||
def load_module(name):
|
||||
"""
|
||||
Import or reload tutorial module as needed.
|
||||
"""
|
||||
"""Import or reload tutorial module as needed."""
|
||||
target = 'cherrypy.tutorial.' + name
|
||||
if target in sys.modules:
|
||||
module = importlib.reload(sys.modules[target])
|
||||
|
|
|
@ -21,9 +21,7 @@ USOCKET_PATH = usocket_path()
|
|||
|
||||
|
||||
class USocketHTTPConnection(HTTPConnection):
|
||||
"""
|
||||
HTTPConnection over a unix socket.
|
||||
"""
|
||||
"""HTTPConnection over a unix socket."""
|
||||
|
||||
def __init__(self, path):
|
||||
HTTPConnection.__init__(self, 'localhost')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue