3
from nose.tools import *
4
from utilities import execution_path
6
import os, sys, glob, mapnik
9
# All of the paths used are relative, if we run the tests
10
# from another directory we need to chdir()
11
os.chdir(execution_path('.'))
13
# We expect these files to not raise any
15
def assert_loads_successfully(file):
16
m = mapnik.Map(512, 512)
19
mapnik.load_map(m, file, strict)
21
# We expect these files to raise a UserWarning
22
# and fail if there isn't one (or a different type
25
def assert_raises_userwarning(file):
26
m = mapnik.Map(512, 512)
29
mapnik.load_map(m, file, strict)
31
def test_broken_files():
32
broken_files = glob.glob("../data/broken_maps/*.xml")
34
# Add a filename that doesn't exist
35
broken_files.append("../data/broken/does_not_exist.xml")
37
for file in broken_files:
38
yield assert_raises_userwarning, file
40
def test_good_files():
41
good_files = glob.glob("../data/good_maps/*.xml")
43
for file in good_files:
44
yield assert_loads_successfully, file