ensure we only modify logger test for specific tests that should be silenced
This commit is contained in:
parent
ff88efc1fd
commit
2457f5f7f4
3 changed files with 13 additions and 4 deletions
|
@ -7,14 +7,19 @@ from nose.tools import *
|
|||
from utilities import execution_path
|
||||
|
||||
import os, mapnik
|
||||
# make the tests silent since we intentially test error conditions that are noisy
|
||||
mapnik.logger.set_severity(mapnik.severity_type.None)
|
||||
|
||||
default_logging_severity = mapnik.logger.get_severity()
|
||||
|
||||
def setup():
|
||||
# make the tests silent since we intentially test error conditions that are noisy
|
||||
mapnik.logger.set_severity(mapnik.severity_type.None)
|
||||
# All of the paths used are relative, if we run the tests
|
||||
# from another directory we need to chdir()
|
||||
os.chdir(execution_path('.'))
|
||||
|
||||
def teardown():
|
||||
mapnik.logger.set_severity(default_logging_severity)
|
||||
|
||||
if 'csv' in mapnik.DatasourceCache.plugin_names():
|
||||
|
||||
def get_csv_ds(filename):
|
||||
|
|
|
@ -11,6 +11,8 @@ def setup():
|
|||
os.chdir(execution_path('.'))
|
||||
|
||||
def test_broken_files():
|
||||
default_logging_severity = mapnik.logger.get_severity()
|
||||
mapnik.logger.set_severity(mapnik.severity_type.None)
|
||||
broken_files = glob.glob("../data/broken_maps/*.xml")
|
||||
# Add a filename that doesn't exist
|
||||
broken_files.append("../data/broken/does_not_exist.xml")
|
||||
|
@ -25,6 +27,7 @@ def test_broken_files():
|
|||
except RuntimeError:
|
||||
pass
|
||||
eq_(len(failures),0,'\n'+'\n'.join(failures))
|
||||
mapnik.logger.set_severity(default_logging_severity)
|
||||
|
||||
def test_good_files():
|
||||
good_files = glob.glob("../data/good_maps/*.xml")
|
||||
|
|
|
@ -11,6 +11,7 @@ def test_logger_init():
|
|||
mapnik.logger.set_severity(mapnik.severity_type.Debug)
|
||||
eq_(mapnik.logger.get_severity(),mapnik.severity_type.Debug)
|
||||
mapnik.logger.set_severity(default)
|
||||
eq_(mapnik.logger.get_severity(),default)
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
|
|
Loading…
Reference in a new issue