Skip to content

Commit

Permalink
Pinning on Reportlab 3.3.0
Browse files Browse the repository at this point in the history
Reportlab 3.4.0 makes for flaky tests, for unknown reasons. Will investigate.
Also updated to Ghostscript 9.22, and dropped Python 3.3 support and added Python 3.6 support.
  • Loading branch information
regebro committed Oct 13, 2017
1 parent 7968863 commit d738ae6
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 162 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -15,10 +15,10 @@ python:
- "3.5"
# The version of GS in the repos is too old and using debian-sid often breaks
before_install:
- wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs920/ghostscript-9.20-linux-x86_64.tgz
- tar -xvf ghostscript-9.20-linux-x86_64.tgz
- mv ghostscript-9.20-linux-x86_64/gs-920-linux_x86_64 ghostscript-9.20-linux-x86_64/gs
- export PATH=$PWD/ghostscript-9.20-linux-x86_64:$PATH
- wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs922/ghostscript-9.22-linux-x86_64.tgz
- tar -xvf ghostscript-9.22-linux-x86_64.tgz
- mv ghostscript-9.22-linux-x86_64/gs-922-linux_x86_64 ghostscript-9.22-linux-x86_64/gs
- export PATH=$PWD/ghostscript-9.22-linux-x86_64:$PATH
install:
- travis_retry pip install tox-travis
script:
Expand Down
Binary file modified src/z3c/rml/rml-reference.pdf
Binary file not shown.
256 changes: 128 additions & 128 deletions src/z3c/rml/rml.dtd

Large diffs are not rendered by default.

Binary file modified src/z3c/rml/tests/expected/rml-examples-032-images.pdf
Binary file not shown.
69 changes: 42 additions & 27 deletions src/z3c/rml/tests/test_rml.py
Expand Up @@ -78,35 +78,41 @@ def assertSameImage(self, baseImage, testImage):
base = base_image.getdata()
test_image = Image.open(test_file)
test = test_image.getdata()
err_count = 0
for i in range(len(base)):
if (base[i] - test[i]) != 0:
if False:
from base64 import b64encode
import PIL
differ = PIL.ImageChops.subtract(base_image, test_image)
# output the result as base64 for travis debugging
# flip the above condition to activate this code
print()
print(os.system("gs --version"))

base_file.seek(0)
print(baseImage)
print(b64encode(base_file.read()))
print(self._basePath)
with open(self._basePath, 'rb') as base_pdf:
print(b64encode(base_pdf.read()))

test_file.seek(0)
print(testImage)
print(b64encode(test_file.read()))
print(self._testPath)
with open(self._testPath, 'rb') as test_pdf:
print(b64encode(test_pdf.read()))

differ.show()

self.fail(
'Image is not the same: %s' % os.path.basename(baseImage))
err_count += 1

# Let each image have 10 pixels of errors, that's just
# flakyness.
if err_count > 0:
if False:
from base64 import b64encode
import PIL
differ = PIL.ImageChops.subtract(base_image, test_image)
differ.show()
import pdb;pdb.set_trace()
# output the result as base64 for travis debugging
# flip the above condition to activate this code
print()
print(os.system("gs --version"))

base_file.seek(0)
print(baseImage)
print(b64encode(base_file.read()))
print(self._basePath)
with open(self._basePath, 'rb') as base_pdf:
print(b64encode(base_pdf.read()))

test_file.seek(0)
print(testImage)
print(b64encode(test_file.read()))
print(self._testPath)
with open(self._testPath, 'rb') as test_pdf:
print(b64encode(test_pdf.read()))

self.fail(
'Image is not the same: %s' % os.path.basename(baseImage))
base_file.close()
test_file.close()

Expand Down Expand Up @@ -152,6 +158,15 @@ def runTest(self):


def test_suite():
if True:
# Debug info
import pkg_resources
print("Environment\n===========")
print("reportlab:")
print(pkg_resources.get_distribution('reportlab').version)
print("ghostscript:")
os.system("gs --version")

suite = unittest.TestSuite()
here = os.path.dirname(z3c.rml.tests.__file__)
inputDir = os.path.join(here, 'input')
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py33,py34,py35
envlist = py27,py34,py35,py36

[testenv]
commands =
Expand All @@ -10,7 +10,7 @@ deps =
coverage
lxml
PyPDF2
reportlab
reportlab==3.3.0
setuptools
six
zope.interface
Expand Down
2 changes: 1 addition & 1 deletion versions.cfg
Expand Up @@ -5,7 +5,7 @@ Pillow = 3.1.1
PyPDF2 = 1.25.1
coverage = 3.7.1
pip = 8.0.2
reportlab = 3.2.0
reportlab = 3.3.0
z3c.coverage = 2.0.3
zc.buildout = 2.5.0
zc.recipe.egg = 2.0.3
Expand Down

0 comments on commit d738ae6

Please sign in to comment.