conditionally run tests based on availability of datasources
This commit is contained in:
parent
c7c8d910c4
commit
af413aa959
4 changed files with 81 additions and 75 deletions
|
@ -9,30 +9,31 @@ def setup():
|
|||
# from another directory we need to chdir()
|
||||
os.chdir(execution_path('.'))
|
||||
|
||||
def test_marker_ellipse_render1():
|
||||
m = mapnik.Map(256,256)
|
||||
mapnik.load_map(m,'../data/good_maps/marker_ellipse_transform.xml')
|
||||
m.zoom_all()
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
actual = '/tmp/mapnik-marker-ellipse-render1.png'
|
||||
expected = 'images/support/mapnik-marker-ellipse-render1.png'
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
def test_marker_ellipse_render2():
|
||||
# currently crashes https://github.com/mapnik/mapnik/issues/1365
|
||||
m = mapnik.Map(256,256)
|
||||
mapnik.load_map(m,'../data/good_maps/marker_ellipse_transform2.xml')
|
||||
m.zoom_all()
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
actual = '/tmp/mapnik-marker-ellipse-render2.png'
|
||||
expected = 'images/support/mapnik-marker-ellipse-render2.png'
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
if 'csv' in mapnik.DatasourceCache.instance().plugin_names():
|
||||
def test_marker_ellipse_render1():
|
||||
m = mapnik.Map(256,256)
|
||||
mapnik.load_map(m,'../data/good_maps/marker_ellipse_transform.xml')
|
||||
m.zoom_all()
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
actual = '/tmp/mapnik-marker-ellipse-render1.png'
|
||||
expected = 'images/support/mapnik-marker-ellipse-render1.png'
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
def test_marker_ellipse_render2():
|
||||
# currently crashes https://github.com/mapnik/mapnik/issues/1365
|
||||
m = mapnik.Map(256,256)
|
||||
mapnik.load_map(m,'../data/good_maps/marker_ellipse_transform2.xml')
|
||||
m.zoom_all()
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
actual = '/tmp/mapnik-marker-ellipse-render2.png'
|
||||
expected = 'images/support/mapnik-marker-ellipse-render2.png'
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
|
|
|
@ -10,29 +10,31 @@ def setup():
|
|||
# from another directory we need to chdir()
|
||||
os.chdir(execution_path('.'))
|
||||
|
||||
def test_map_alpha_compare():
|
||||
m = mapnik.Map(600,400)
|
||||
mapnik.load_map(m,'../data/good_maps/raster-alpha.xml')
|
||||
m.zoom_all()
|
||||
actual = '/tmp/mapnik-raster-alpha.png'
|
||||
expected = 'images/support/raster-alpha.png'
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
if 'gdal' in mapnik.DatasourceCache.instance().plugin_names():
|
||||
|
||||
def test_map_alpha_gradient_compare():
|
||||
m = mapnik.Map(600,400)
|
||||
mapnik.load_map(m,'../data/good_maps/raster-alpha-gradient.xml')
|
||||
m.zoom_all()
|
||||
actual = '/tmp/mapnik-raster-alpha-gradient.png'
|
||||
expected = 'images/support/raster-alpha-gradient.png'
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
def test_map_alpha_compare():
|
||||
m = mapnik.Map(600,400)
|
||||
mapnik.load_map(m,'../data/good_maps/raster-alpha.xml')
|
||||
m.zoom_all()
|
||||
actual = '/tmp/mapnik-raster-alpha.png'
|
||||
expected = 'images/support/raster-alpha.png'
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
def test_map_alpha_gradient_compare():
|
||||
m = mapnik.Map(600,400)
|
||||
mapnik.load_map(m,'../data/good_maps/raster-alpha-gradient.xml')
|
||||
m.zoom_all()
|
||||
actual = '/tmp/mapnik-raster-alpha-gradient.png'
|
||||
expected = 'images/support/raster-alpha-gradient.png'
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -9,29 +9,31 @@ def setup():
|
|||
# from another directory we need to chdir()
|
||||
os.chdir(execution_path('.'))
|
||||
|
||||
def test_vrt_rendering():
|
||||
m = mapnik.Map(512,512)
|
||||
mapnik.load_map(m,'../data/good_maps/vrt_colortable.xml')
|
||||
m.zoom_all()
|
||||
im = mapnik.Image(512,512)
|
||||
mapnik.render(m,im)
|
||||
actual = '/tmp/vrt_colortable.png'
|
||||
expected = 'images/support/vrt_colortable.png'
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
if 'gdal' in mapnik.DatasourceCache.instance().plugin_names():
|
||||
|
||||
def test_tif_rendering_nodata():
|
||||
m = mapnik.Map(512,512)
|
||||
mapnik.load_map(m,'../data/good_maps/tiff_colortable.xml')
|
||||
m.zoom_all()
|
||||
im = mapnik.Image(512,512)
|
||||
mapnik.render(m,im)
|
||||
actual = '/tmp/tif_colortable.png'
|
||||
expected = 'images/support/tif_colortable.png'
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
def test_vrt_rendering():
|
||||
m = mapnik.Map(512,512)
|
||||
mapnik.load_map(m,'../data/good_maps/vrt_colortable.xml')
|
||||
m.zoom_all()
|
||||
im = mapnik.Image(512,512)
|
||||
mapnik.render(m,im)
|
||||
actual = '/tmp/vrt_colortable.png'
|
||||
expected = 'images/support/vrt_colortable.png'
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
def test_tif_rendering_nodata():
|
||||
m = mapnik.Map(512,512)
|
||||
mapnik.load_map(m,'../data/good_maps/tiff_colortable.xml')
|
||||
m.zoom_all()
|
||||
im = mapnik.Image(512,512)
|
||||
mapnik.render(m,im)
|
||||
actual = '/tmp/tif_colortable.png'
|
||||
expected = 'images/support/tif_colortable.png'
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
|
|
|
@ -84,11 +84,12 @@ if __name__ == "__main__":
|
|||
for name in sys.argv[1:]:
|
||||
files.append({"name": name})
|
||||
|
||||
for f in files:
|
||||
config = dict(defaults)
|
||||
config.update(f)
|
||||
for size in config['sizes']:
|
||||
m = render(config['name'], size[0], size[1], config['bbox'], quiet=quiet)
|
||||
mapnik.save_map(m, os.path.join(dirname, 'xml_output', "%s-out.xml" % config['name']))
|
||||
if 'osm' in mapnik.DatasourceCache.instance().plugin_names():
|
||||
for f in files:
|
||||
config = dict(defaults)
|
||||
config.update(f)
|
||||
for size in config['sizes']:
|
||||
m = render(config['name'], size[0], size[1], config['bbox'], quiet=quiet)
|
||||
mapnik.save_map(m, os.path.join(dirname, 'xml_output', "%s-out.xml" % config['name']))
|
||||
|
||||
summary()
|
||||
summary()
|
||||
|
|
Loading…
Add table
Reference in a new issue