Skip to content

Commit

Permalink
Fix escaping errors
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 5, 2020
1 parent 80f5a0b commit d084ad9
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests/code_layout/doxygen_parser.py
Expand Up @@ -463,7 +463,7 @@ def isOperator(self, member_elem):
"""
try:
name = member_elem.find('name').text
if re.match('^operator\W.*', name):
if re.match(r'^operator\W.*', name):
return True
except:
pass
Expand Down
4 changes: 2 additions & 2 deletions tests/code_layout/test_qgsdoccoverage.py
Expand Up @@ -76,14 +76,14 @@ def testCoverage(self):
if parser.classes_missing_group:
print("---------------------------------")
print('\n')
print((colored('{} classes have been added without Doxygen group tag ("\ingroup"):'.format(len(parser.classes_missing_group)), 'yellow')))
print((colored('{} classes have been added without Doxygen group tag ("\\ingroup"):'.format(len(parser.classes_missing_group)), 'yellow')))
print('')
print((' ' + '\n '.join([colored(cls, 'yellow', attrs=['bold']) for cls in parser.classes_missing_group])))

if parser.classes_missing_version_added:
print("---------------------------------")
print('\n')
print((colored('{} classes have been added without a version added doxygen note ("\since QGIS x.xx"):'.format(len(parser.classes_missing_version_added)), 'yellow')))
print((colored('{} classes have been added without a version added doxygen note ("\\since QGIS x.xx"):'.format(len(parser.classes_missing_version_added)), 'yellow')))
print('')
print((' ' + '\n '.join([colored(cls, 'yellow', attrs=['bold']) for cls in parser.classes_missing_version_added])))

Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_authmanager_oauth2_ows.py
Expand Up @@ -164,7 +164,7 @@ def setUpClass(cls):
cls.server = subprocess.Popen([sys.executable, server_path],
env=os.environ, stdout=subprocess.PIPE)
line = cls.server.stdout.readline()
cls.port = int(re.findall(b':(\d+)', line)[0])
cls.port = int(re.findall(br':(\d+)', line)[0])
assert cls.port != 0

# We need a valid port before we setup the oauth configuration
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_authmanager_password_ows.py
Expand Up @@ -105,7 +105,7 @@ def setUpClass(cls):
env=os.environ, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

line = cls.server.stdout.readline()
cls.port = int(re.findall(b':(\d+)', line)[0])
cls.port = int(re.findall(br':(\d+)', line)[0])
assert cls.port != 0
# Wait for the server process to start
assert waitServer('%s://%s:%s' % (cls.protocol, cls.hostname, cls.port)), "Server is not responding! %s://%s:%s" % (cls.protocol, cls.hostname, cls.port)
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsprocessexecutable.py
Expand Up @@ -161,7 +161,7 @@ def testModelRun(self):
# internal binary will match, minus the '.app'
found = False
for app_path in glob.glob(d + '/QGIS*.app'):
m = re.search('/(QGIS(_\d\.\d-dev)?)\.app', app_path)
m = re.search(r'/(QGIS(_\d\.\d-dev)?)\.app', app_path)
if m:
QGIS_PROCESS_BIN = app_path + '/Contents/MacOS/' + m.group(1)
found = True
Expand Down
6 changes: 3 additions & 3 deletions tests/src/python/test_qgsserver_wfs.py
Expand Up @@ -35,8 +35,8 @@
from test_qgsserver import QgsServerTestBase

# Strip path and content length because path may vary
RE_STRIP_UNCHECKABLE = b'MAP=[^"]+|Content-Length: \d+|timeStamp="[^"]+"'
RE_ATTRIBUTES = b'[^>\s]+=[^>\s]+'
RE_STRIP_UNCHECKABLE = br'MAP=[^"]+|Content-Length: \d+|timeStamp="[^"]+"'
RE_ATTRIBUTES = br'[^>\s]+=[^>\s]+'


class TestQgsServerWFS(QgsServerTestBase):
Expand Down Expand Up @@ -109,7 +109,7 @@ def wfs_getfeature_compare(self, requestid, request):
header, body = self._execute_request(query_string)

if requestid == 'hits':
body = re.sub(b'timeStamp="\d+-\d+-\d+T\d+:\d+:\d+"',
body = re.sub(br'timeStamp="\d+-\d+-\d+T\d+:\d+:\d+"',
b'timeStamp="****-**-**T**:**:**"', body)

self.result_compare(
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsserver_wfst.py
Expand Up @@ -92,7 +92,7 @@ def setUpClass(cls):
cls.server = subprocess.Popen([sys.executable, server_path],
env=os.environ, stdout=subprocess.PIPE)
line = cls.server.stdout.readline()
cls.port = int(re.findall(b':(\d+)', line)[0])
cls.port = int(re.findall(r':(\d+)', line)[0])
assert cls.port != 0
# Wait for the server process to start
assert waitServer('http://127.0.0.1:%s' % cls.port), "Server is not responding!"
Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_qgsserver_wms_getlegendgraphic.py
Expand Up @@ -33,8 +33,8 @@
from qgis.core import QgsProject

# Strip path and content length because path may vary
RE_STRIP_UNCHECKABLE = b'MAP=[^"]+|Content-Length: \d+'
RE_ATTRIBUTES = b'[^>\s]+=[^>\s]+'
RE_STRIP_UNCHECKABLE = br'MAP=[^"]+|Content-Length: \d+'
RE_ATTRIBUTES = br'[^>\s]+=[^>\s]+'


class TestQgsServerWMSGetLegendGraphic(TestQgsServerWMSTestBase):
Expand Down
12 changes: 6 additions & 6 deletions tests/src/python/test_qgsserver_wms_getprint.py
Expand Up @@ -40,8 +40,8 @@
from utilities import getExecutablePath, unitTestDataPath

# Strip path and content length because path may vary
RE_STRIP_UNCHECKABLE = b'MAP=[^"]+|Content-Length: \d+'
RE_ATTRIBUTES = b'[^>\s]+=[^>\s]+'
RE_STRIP_UNCHECKABLE = br'MAP=[^"]+|Content-Length: \d+'
RE_ATTRIBUTES = br'[^>\s]+=[^>\s]+'


class TestQgsServerWMSGetPrint(QgsServerTestBase):
Expand Down Expand Up @@ -126,16 +126,16 @@ def _pdf_diff_error(self, response, headers, image, max_diff=100, max_size_diff=

with open(os.path.join(tempfile.gettempdir(), image + "_result.pdf"), "rb") as rendered_file:
if not os.environ.get('ENCODED_OUTPUT'):
message = "PDF is wrong\: rendered file %s/%s_result.%s" % (tempfile.gettempdir(), image, 'pdf')
message = "PDF is wrong: rendered file %s/%s_result.%s" % (tempfile.gettempdir(), image, 'pdf')
else:
encoded_rendered_file = base64.b64encode(rendered_file.read())
message = "PDF is wrong\n%s\File:\necho '%s' | base64 -d >%s/%s_result.%s" % (
message = "PDF is wrong\n%sFile:\necho '%s' | base64 -d >%s/%s_result.%s" % (
report, encoded_rendered_file.strip().decode('utf8'), tempfile.gettempdir(), image, 'pdf'
)

with open(os.path.join(tempfile.gettempdir(), image + "_result.png"), "rb") as rendered_file:
if not os.environ.get('ENCODED_OUTPUT'):
message = "Image is wrong\: rendered file %s/%s_result.%s" % (tempfile.gettempdir(), image, 'png')
message = "Image is wrong: rendered file %s/%s_result.%s" % (tempfile.gettempdir(), image, 'png')
else:
encoded_rendered_file = base64.b64encode(rendered_file.read())
message = "Image is wrong\n%s\nImage:\necho '%s' | base64 -d >%s/%s_result.%s" % (
Expand All @@ -146,7 +146,7 @@ def _pdf_diff_error(self, response, headers, image, max_diff=100, max_size_diff=
if os.path.exists(os.path.join(tempfile.gettempdir(), image + "_result_diff.png")):
with open(os.path.join(tempfile.gettempdir(), image + "_result_diff.png"), "rb") as diff_file:
if not os.environ.get('ENCODED_OUTPUT'):
message = "Image is wrong\: diff file %s/%s_result_diff.%s" % (tempfile.gettempdir(), image, 'png')
message = "Image is wrong: diff file %s/%s_result_diff.%s" % (tempfile.gettempdir(), image, 'png')
else:
encoded_diff_file = base64.b64encode(diff_file.read())
message += "\nDiff:\necho '%s' | base64 -d > %s/%s_result_diff.%s" % (
Expand Down
Expand Up @@ -38,6 +38,7 @@ def initProcessing(self):
def unload(self):
pass


def classFactory(iface):
# load Test class from file Test
return Test(iface)

0 comments on commit d084ad9

Please sign in to comment.