mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -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
|
@ -4,9 +4,9 @@ import sys
|
|||
import time
|
||||
from uuid import UUID
|
||||
|
||||
import six
|
||||
import pytest
|
||||
|
||||
from cherrypy._cpcompat import text_or_bytes, ntob
|
||||
from cherrypy._cpcompat import text_or_bytes
|
||||
|
||||
|
||||
try:
|
||||
|
@ -45,6 +45,7 @@ class LogCase(object):
|
|||
unique enough from normal log output to use for marker identification.
|
||||
"""
|
||||
|
||||
interactive = False
|
||||
logfile = None
|
||||
lastmarker = None
|
||||
markerPrefix = b'test suite marker: '
|
||||
|
@ -54,7 +55,7 @@ class LogCase(object):
|
|||
print(' ERROR: %s' % msg)
|
||||
|
||||
if not self.interactive:
|
||||
raise self.failureException(msg)
|
||||
raise pytest.fail(msg)
|
||||
|
||||
p = (' Show: '
|
||||
'[L]og [M]arker [P]attern; '
|
||||
|
@ -86,7 +87,7 @@ class LogCase(object):
|
|||
# return without raising the normal exception
|
||||
return
|
||||
elif i == 'R':
|
||||
raise self.failureException(msg)
|
||||
raise pytest.fail(msg)
|
||||
elif i == 'X':
|
||||
self.exit()
|
||||
sys.stdout.write(p + ' ')
|
||||
|
@ -105,7 +106,9 @@ class LogCase(object):
|
|||
self.lastmarker = key
|
||||
|
||||
open(self.logfile, 'ab+').write(
|
||||
ntob('%s%s\n' % (self.markerPrefix, key), 'utf-8'))
|
||||
b'%s%s\n'
|
||||
% (self.markerPrefix, key.encode('utf-8'))
|
||||
)
|
||||
|
||||
def _read_marked_region(self, marker=None):
|
||||
"""Return lines from self.logfile in the marked region.
|
||||
|
@ -121,7 +124,7 @@ class LogCase(object):
|
|||
if marker is None:
|
||||
return open(logfile, 'rb').readlines()
|
||||
|
||||
if isinstance(marker, six.text_type):
|
||||
if isinstance(marker, str):
|
||||
marker = marker.encode('utf-8')
|
||||
data = []
|
||||
in_region = False
|
||||
|
@ -201,7 +204,7 @@ class LogCase(object):
|
|||
# Single arg. Use __getitem__ and allow lines to be str or list.
|
||||
if isinstance(lines, (tuple, list)):
|
||||
lines = lines[0]
|
||||
if isinstance(lines, six.text_type):
|
||||
if isinstance(lines, str):
|
||||
lines = lines.encode('utf-8')
|
||||
if lines not in data[sliceargs]:
|
||||
msg = '%r not found on log line %r' % (lines, sliceargs)
|
||||
|
@ -221,7 +224,7 @@ class LogCase(object):
|
|||
|
||||
start, stop = sliceargs
|
||||
for line, logline in zip(lines, data[start:stop]):
|
||||
if isinstance(line, six.text_type):
|
||||
if isinstance(line, str):
|
||||
line = line.encode('utf-8')
|
||||
if line not in logline:
|
||||
msg = '%r not found in log' % line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue