diff --git a/Makefile b/Makefile index 51a2abbab..e8957a80d 100755 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ uninstall: test: @python tests/run_tests.py -q + @python tests/visual_tests/test.py pep8: # https://gist.github.com/1903033 diff --git a/tests/visual_tests/compare.py b/tests/visual_tests/compare.py index 414f49979..46bba923e 100644 --- a/tests/visual_tests/compare.py +++ b/tests/visual_tests/compare.py @@ -42,9 +42,9 @@ def compare(fn1, fn2): def summary(): global errors + print "-"*80 + print "Summary:" if len(errors) != 0: - print "-"*80 - print "Summary:" for error in errors: if (error[1] is None): print "Could not verify %s: No reference image found!" % error[0] @@ -52,3 +52,7 @@ def summary(): print "%s failed: %d different pixels" % error print "-"*80 sys.exit(1) + else: + print 'No errors detected!' + print "-"*80 + sys.exit(0) diff --git a/tests/visual_tests/test.py b/tests/visual_tests/test.py index 554c1c5c5..29716e6bd 100755 --- a/tests/visual_tests/test.py +++ b/tests/visual_tests/test.py @@ -19,6 +19,7 @@ sizes_many_in_small_range = [(490, 100), (495, 100), (497, 100), (498, 100), (499, 100), (500, 100), (501, 100), (502, 100), (505, 100), (510, 100)] dirname = os.path.dirname(__file__) + files = [ {'name': "list", 'sizes': sizes_many_in_big_range}, {'name': "simple", 'sizes': sizes_many_in_big_range}, diff --git a/tests/visual_tests/test_python.py b/tests/visual_tests/test_python.py index 0cba25907..9648a8626 100755 --- a/tests/visual_tests/test_python.py +++ b/tests/visual_tests/test_python.py @@ -4,6 +4,8 @@ import sys import os.path from compare import compare, summary +dirname = os.path.dirname(__file__) + class MyText(mapnik.FormattingNode): def __init__(self): mapnik.FormattingNode.__init__(self) @@ -69,7 +71,7 @@ m.append_style('Style', style) layer = mapnik.Layer('Layer') -layer.datasource = mapnik.Shapefile(file="data/points.shp") +layer.datasource = mapnik.Shapefile(file=os.path.join(dirname,"data/points.shp")) layer.styles.append('Style') m.layers.append(layer) @@ -97,9 +99,9 @@ format_trees = [ for format_tree in format_trees: text.placements.defaults.format_tree = format_tree[1] - mapnik.render_to_file(m, os.path.join("images", 'python-%s.png' % format_tree[0]), 'png') - compare(os.path.join("images", 'python-%s.png' % format_tree[0]), - os.path.join("images", 'python-%s-reference.png' % format_tree[0]) + mapnik.render_to_file(m, os.path.join(dirname,"images", 'python-%s.png' % format_tree[0]), 'png') + compare(os.path.join(dirname,"images", 'python-%s.png' % format_tree[0]), + os.path.join(dirname,"images", 'python-%s-reference.png' % format_tree[0]) ) summary()