1- #!/usr/bin/env python
2- # -*- coding: utf-8 -*-
3-
41import os
52import pickle
6-
7- from nose .tools import eq_
8-
3+ import pytest
94import mapnik
5+ from .utilities import execution_path
106
11- from .utilities import execution_path , run_all
12-
13-
7+ @pytest .fixture (scope = "module" )
148def setup ():
159 # All of the paths used are relative, if we run the tests
1610 # from another directory we need to chdir()
1711 os .chdir (execution_path ('.' ))
12+ yield
1813
1914
20- # def test_color_pickle():
21- # c = mapnik.Color('blue')
22- # eq_( pickle.loads(pickle.dumps(c)), c)
23- # c = mapnik.Color(0, 64, 128)
24- # eq_( pickle.loads(pickle.dumps(c)), c)
25- # c = mapnik.Color(0, 64, 128, 192)
26- # eq_( pickle.loads(pickle.dumps(c)), c)
15+ def test_color_pickle ():
16+ c = mapnik .Color ('blue' )
17+ assert pickle .loads (pickle .dumps (c )) == c
18+ c = mapnik .Color (0 , 64 , 128 )
19+ assert pickle .loads (pickle .dumps (c )) == c
20+ c = mapnik .Color (0 , 64 , 128 , 192 )
21+ assert pickle .loads (pickle .dumps (c )) == c
2722
2823
29- # def test_envelope_pickle():
30- # e = mapnik.Box2d(100, 100, 200, 200)
31- # eq_( pickle.loads(pickle.dumps(e)), e)
24+ def test_envelope_pickle ():
25+ e = mapnik .Box2d (100 , 100 , 200 , 200 )
26+ assert pickle .loads (pickle .dumps (e )) == e
3227
3328
3429def test_parameters_pickle ():
@@ -37,9 +32,5 @@ def test_parameters_pickle():
3732
3833 params2 = pickle .loads (pickle .dumps (params , pickle .HIGHEST_PROTOCOL ))
3934
40- eq_ (params [0 ][0 ], params2 [0 ][0 ])
41- eq_ (params [0 ][1 ], params2 [0 ][1 ])
42-
43- if __name__ == "__main__" :
44- setup ()
45- exit (run_all (eval (x ) for x in dir () if x .startswith ("test_" )))
35+ assert params [0 ][0 ] == params2 [0 ][0 ]
36+ assert params [0 ][1 ] == params2 [0 ][1 ]
0 commit comments