test touchups to ensure they can all be run individually

This commit is contained in:
Dane Springmeyer 2011-08-30 22:51:42 +00:00
parent a19402f35c
commit 74877c8778
18 changed files with 98 additions and 20 deletions

View file

@ -53,3 +53,7 @@ def test_pycairo_svg_surface():
def test_pycairo_svg_surface():
return _pycairo_surface('ps','polygon')
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -86,4 +86,5 @@ def test_hit_grid():
eq_(hit_list[-12:],'1:Chile|812:')
if __name__ == '__main__':
test_hit_grid()
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -66,7 +66,4 @@ def test_feature_hit_count():
if __name__ == "__main__":
setup()
test_shapefile_line_featureset_id()
test_shapefile_polygon_featureset_id()
test_shapefile_polygon_feature_query_id()
test_feature_hit_count()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -50,3 +50,6 @@ class FeatureTest(unittest.TestCase):
self.failUnlessEqual(env.miny, env.maxy)
add_it(Geometry2d.from_wkt('Point(3 6)'))
if __name__ == "__main__":
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -118,5 +118,7 @@ def test_unicode_regex_replace():
expr = mapnik2.Expression("[name].replace('(\B)|( )','$1 ')")
eq_(expr.evaluate(f),'Q u é b e c')
if __name__ == "__main__":
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -11,3 +11,6 @@ import mapnik2, pickle
#@raises(UserWarning)
#def test_invalid_font():
# ts = mapnik2.TextSymbolizer('Name', 'Invalid Font Name', int(8), mapnik2.Color('black'))
if __name__ == "__main__":
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -2,6 +2,7 @@
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, save_data, contains_word
import os, mapnik2
@ -52,7 +53,6 @@ def test_load_save_load_map():
map = mapnik2.Map(256,256)
mapnik2.load_map_from_string(map, out_map.encode('utf8'))
assert 'GlyphSymbolizer' in out_map
assert 'RasterColorizer' in out_map
# make sure non-ascii characters are well supported since most interesting
# glyphs for symbology are usually in that range
assert u'í' in out_map, out_map
@ -93,3 +93,7 @@ def create_map_and_append_symbolyzer(sym):
_map.zoom_to_box(mapnik2.Box2d(0,0,8,8))
return _map
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -1,10 +1,17 @@
#!/usr/bin/env python
import os
from nose.tools import *
from utilities import execution_path
from utilities import Todo
import mapnik2
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_introspect_symbolizers():
# create a symbolizer
p = mapnik2.PointSymbolizer(mapnik2.PathExpression("../data/images/dummy.png"))
@ -58,3 +65,8 @@ def test_introspect_symbolizers():
eq_(p2.allow_overlap, True)
eq_(p2.opacity, 0.5)
eq_(p2.filename,'../data/images/dummy.png')
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -2,8 +2,16 @@
from nose.tools import *
import os
from nose.tools import *
from utilities import execution_path
import mapnik2
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_adding_datasource_to_layer():
map_string = '''<?xml version="1.0" encoding="utf-8"?>
<Map>
@ -59,5 +67,8 @@ def test_adding_datasource_to_layer():
eq_(m.layers[0].srs,'+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')
eq_(lyr.srs,'+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs')
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -48,3 +48,7 @@ def test_good_files():
for file in good_files:
yield assert_loads_successfully, file
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -38,3 +38,6 @@ class MemoryDatasource(unittest.TestCase):
retrieved = md.features_at_point(Coord(20,30)).features
self.failUnlessEqual(len(retrieved), 0)
if __name__ == "__main__":
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -1,10 +1,17 @@
#!/usr/bin/env python
import os
from nose.tools import *
from utilities import execution_path
from utilities import Todo
import mapnik2, pickle
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
# Tests that exercise the functionality of Mapnik classes.
# ShieldSymbolizer initialization
@ -743,3 +750,7 @@ def test_envelope_pickle():
e1.clip(e2)
eq_(e1,e2)
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -45,3 +45,6 @@ def test_wgs84_inverse_forward():
assert_almost_equal(e.forward(p).center().y, e.center().y)
assert_almost_equal(e.forward(p).center().x, e.center().x)
if __name__ == "__main__":
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -1,6 +1,13 @@
import os
import mapnik2
from utilities import execution_path
from nose.tools import *
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_gen_map():
mapxmlfile = '../data/good_maps/raster_colorizer.xml'
mapxmloutputfile = 'raster_colorizer_test_save.xml'
@ -12,10 +19,6 @@ def test_gen_map():
m.zoom_all()
mapnik2.render_to_file(m, outputfile)
#test discrete colorizer mode
def test_get_color_discrete():
#setup
@ -40,8 +43,6 @@ def test_get_color_discrete():
eq_(colorizer.get_color(20), mapnik2.Color(200,200,200,200));
eq_(colorizer.get_color(1000), mapnik2.Color(200,200,200,200));
#test exact colorizer mode
def test_get_color_exact():
#setup
@ -92,4 +93,8 @@ def test_get_color_linear():
#after stop 2
eq_(colorizer.get_color(100), mapnik2.Color(200,200,200,200));
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -132,3 +132,6 @@ def test_raster_with_alpha_blends_correctly_with_background():
# All white is expected
assert contains_word('\xff\xff\xff\xff', imdata)
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -143,5 +143,4 @@ def test_render_grid2():
eq_(resolve(utf5,38,46),{"Name": "South East"})
if __name__ == "__main__":
test_render_grid()
test_render_grid2()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -4,8 +4,17 @@
from nose.tools import *
import os, mapnik2
from nose.tools import *
from utilities import execution_path
from utilities import Todo
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_simplest_render():
m = mapnik2.Map(256, 256)
i = mapnik2.Image(m.width, m.height)
@ -210,6 +219,6 @@ def test_render_points():
num_points_rendered = svg.count('<image ')
eq_(num_points_present, num_points_rendered, "Not all points were rendered (%d instead of %d) at projection %s" % (num_points_rendered, num_points_present, projdescr))
if __name__ == "__main__":
test_render_grid()
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -55,3 +55,7 @@ def test():
for m in glob.glob("../data/good_maps/*.xml"):
compare_map(m)
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]