Skip to content

Commit

Permalink
Disable diff image encoded output
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jan 10, 2018
1 parent 0c93eab commit 902dfb8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/src/python/test_qgsserver.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServer.
Set the env var NO_ENCODED_OUTPUT to disable printing the base64 encoded image diff
Set the env var ENCODED_OUTPUT to enable printing the base64 encoded image diff
FIXME: keep here only generic server tests and move specific services
tests to test_qgsserver_<service>.py
Expand Down Expand Up @@ -191,7 +191,7 @@ def _img_diff_error(self, response, headers, image, max_diff=100, max_size_diff=

with open(os.path.join(tempfile.gettempdir(), image + "_result.png"), "rb") as rendered_file:
encoded_rendered_file = base64.b64encode(rendered_file.read())
if os.environ.get('NO_ENCODED_OUTPUT'):
if not os.environ.get('ENCODED_OUTPUT'):
message = "Image is wrong\: rendered file %s/%s_result.png" % (tempfile.gettempdir(), image)
else:
message = "Image is wrong\n%s\nImage:\necho '%s' | base64 -d >%s/%s_result.png" % (
Expand All @@ -201,7 +201,7 @@ def _img_diff_error(self, response, headers, image, max_diff=100, max_size_diff=
# If the failure is in image sizes the diff file will not exists.
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 os.environ.get('NO_ENCODED_OUTPUT'):
if not os.environ.get('ENCODED_OUTPUT'):
message = "Image is wrong\: diff file %s/%s_result_diff.png" % (tempfile.gettempdir(), image)
else:
encoded_diff_file = base64.b64encode(diff_file.read())
Expand Down

0 comments on commit 902dfb8

Please sign in to comment.