Fix Python3 syntax issues in Python tests#5572
Conversation
|
@geographika you should get notifications for this... |
|
@claudep - thanks for these. I'm working on updating Appveyor to run both p2 and py3 tests. |
|
I found a bunch of other things to update. However, I'm struggling to follow instructions to properly build python mapscript. Instructions are scattered through several files. What instructions should I follow? |
|
Ha! now some tests run which did not run before, so we have new errors. |
|
There should be rounding applied to the tests from here - https://github.com/mapserver/mapserver/blob/branch-7-0/mapscript/python/tests/cases/testing.py#L118 Are you running on Linux or Windows when building MapScript? The .travis.yaml and AppVeyor.yaml files show working builds for each OS. |
|
Linux-only here 😄 |
|
The test utilities you suggested are in the mapscript python tests, while the errors are in the mapserver/msautotest tests. Should we copy the same sort of utilities in msautotest? |
|
I'm still getting errors when running Python mapscript tests, even if they are not visible on Travis. Specifically, hash table tests are failing, because since 10fe3d7, hashTableObj in Python is a dict instead of a swig proxy of hashTableObj (@rouault should know why this was done). However, this should also affect Python 2 and has nothing to do with this patch. |
|
@claudep - the conversion of the hashTableObj to a Python dict creates a much nicer Python API. According to this link the above syntax is incorrect as "the macro PY_VERSION_HEX is only defined when compiling the code (and including the python header), but not when SWIG parses the code." Could you try building with the following? This is the approach/syntax used by @rouault in the GDAL bindings as can be seen here. |
|
Thanks for these findings. I'm not sure I'll be able to work on this before the start of next week.
Yes I admit, but it is backwards incompatible as it contradicts the API documentation stating that keys are case-insensitive and several API disappeared (clear, nextkey, remove, set). The docs should explain that at least. |
|
Just pushed with the suggested modifications. |
|
@claudep - excellent work, and an big step forward in getting the test suite matching the current API and ready for Python3. @Schpidi - I've reviewed the above changes. They all relate to Python MapScript files, and all enabled tests are passing, so I'd be for merging to master. |
|
Sorry, that slipped through. Thanks for taking care! |
No description provided.