Skip to content

Commit

Permalink
run render tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Grainger committed Jul 12, 2017
1 parent 4959936 commit 689fb12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest import TestSuite
from doctest import DocTestSuite
from . import render

module_names = [
'elaphe',
Expand Down Expand Up @@ -38,3 +39,6 @@
# doctests
for module_name in module_names:
suite.addTest(DocTestSuite(module_name))


render.collect(suite)
16 changes: 9 additions & 7 deletions test/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from elaphe import barcode
from os import makedirs
from os.path import abspath, dirname, join
from StringIO import StringIO
from io import BytesIO
from uu import encode as uuencode


Expand Down Expand Up @@ -78,11 +78,11 @@ def runTest(self):
else:
# else, just write generated image
diag = generated
sio_img = StringIO()
sio_img = BytesIO()
diag.convert('L').save(sio_img, 'PNG')
# reopen sio_img
sio_img = StringIO(sio_img.getvalue())
sio_uu = StringIO()
sio_img = BytesIO(sio_img.getvalue())
sio_uu = BytesIO()
uuencode(sio_img, sio_uu, name='diag_%s' % img_filename)
raise AssertionError(
'Image difference detected (%s)\n'
Expand Down Expand Up @@ -112,10 +112,12 @@ def gen_test_images(symbology):
generated.save(join(img_prefix, img_filename), 'PNG')


suite = TestSuite()
def collect(ts):
for symbology in symbologies:
ts.addTest(gen_render_test_case(symbology))

for symbology in symbologies:
suite.addTest(gen_render_test_case(symbology))

suite = collect(TestSuite())


if __name__ == '__main__':
Expand Down

0 comments on commit 689fb12

Please sign in to comment.