-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
simplekml maintains global state between successive calls.
This makes it difficult to test a process that uses simplekml to generate
multiple kml files, as the content of each kml file depends upon which kml
files were previously generated.
This global state is stored in the _id variable of the Feature class.
(visible in featfeom.py at latest revision at time of writing:
9f7f6912e183db7f7829cb5aea0c1595fea1cdf6)
A small demonstration of this behaviour is provided in test_simplekml.py (see
attached).
To replicate:
py.test test_simple.py
Expected behaviour: test passes
observed behaviour:
py.test test_simplekml.py
================================================= test session starts
===============
platform win32 -- Python 2.7.3 -- pytest-2.3.5
plugins: cov, xdist
collected 1 items
test_simplekml.py F
====================================================== FAILURES
=====================
___________________________________________________ test_invariance
_________________
def test_invariance():
> assert make_trivial_kml() == make_trivial_kml()
E assert u'<?xml versi...nt>\n</kml>\n' == u'<?xml versio...nt>\n</kml>\n'
E Skipping 142 identical leading characters in diff, use -v to show
E Skipping 46 identical trailing characters in diff, use -v to show
E - id="feat_1">
E ? ^
E + id="feat_2">
E ? ^
test_simplekml.py:8: AssertionError
============================================== 1 failed in 0.07 seconds
=============
Original issue reported on code.google.com by [email protected] on 29 Jul 2013 at 5:37
Attachments:
Reactions are currently unavailable