From 35a10d48cc98ed5c262a68cfd0340ab9c3ac2a4d Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 26 Sep 2012 14:12:55 -0700 Subject: [PATCH] remove the uneeded save_data test utility function --- tests/python_tests/multi_tile_raster_test.py | 4 +--- tests/python_tests/raster_symbolizer_test.py | 11 +---------- tests/python_tests/utilities.py | 14 -------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/tests/python_tests/multi_tile_raster_test.py b/tests/python_tests/multi_tile_raster_test.py index ce2854f31..fff685487 100644 --- a/tests/python_tests/multi_tile_raster_test.py +++ b/tests/python_tests/multi_tile_raster_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path, save_data, contains_word +from utilities import execution_path, contains_word import os, mapnik @@ -40,8 +40,6 @@ def test_multi_tile_policy(): im = mapnik.Image(_map.width, _map.height) mapnik.render(_map, im) - save_data('test_multi_tile_policy.png', im.tostring('png')) - # test green chunk eq_(im.view(0,64,1,1).tostring(), '\x00\xff\x00\xff') eq_(im.view(127,64,1,1).tostring(), '\x00\xff\x00\xff') diff --git a/tests/python_tests/raster_symbolizer_test.py b/tests/python_tests/raster_symbolizer_test.py index f285c615f..9e7870703 100644 --- a/tests/python_tests/raster_symbolizer_test.py +++ b/tests/python_tests/raster_symbolizer_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path, save_data, contains_word +from utilities import execution_path, contains_word import os, mapnik @@ -51,8 +51,6 @@ def test_dataraster_coloring(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_dataraster_coloring.png', im.tostring('png')) imdata = im.tostring() # we have some values in the [20,30) interval so check that they're colored assert contains_word('\xff\xff\x00\xff', imdata) @@ -135,8 +133,6 @@ def test_raster_with_alpha_blends_correctly_with_background(): mim = mapnik.Image(WIDTH, HEIGHT) mapnik.render(map, mim) - save_data('test_raster_with_alpha_blends_correctly_with_background.png', - mim.tostring('png')) imdata = mim.tostring() # All white is expected assert contains_word('\xff\xff\xff\xff', imdata) @@ -166,8 +162,6 @@ def test_raster_warping(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_raster_warping.png', im.tostring('png')) imdata = im.tostring() assert contains_word('\xff\xff\x00\xff', imdata) @@ -195,9 +189,6 @@ def test_raster_warping_does_not_overclip_source(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_raster_warping_does_not_overclip_source.png', - im.tostring('png')) assert im.view(0,200,1,1).tostring()=='\xff\xff\x00\xff' if __name__ == "__main__": diff --git a/tests/python_tests/utilities.py b/tests/python_tests/utilities.py index f76c5e54a..b47df7be4 100644 --- a/tests/python_tests/utilities.py +++ b/tests/python_tests/utilities.py @@ -15,20 +15,6 @@ class TodoPlugin(ErrorClassPlugin): todo = ErrorClass(Todo, label='TODO', isfailure=False) -def save_data(filename, data, key='MAPNIK_TEST_DATA_DIR'): - """Saves bytestring 'data' into os.environ[key]/filename if - key in os.environ""" - if key in os.environ: - dir = os.environ[key] - if not os.path.exists(dir): - os.makedirs(dir) - fname = os.path.join(dir, filename) - f = open(fname, 'w') - try: - f.write(data) - finally: - f.close() - def contains_word(word, bytestring_): """ Checks that a bytestring contains a given word. len(bytestring) should be