| 1 | From b728c0815edc06c826fb5be8cd25cbb7f3b816b3 Mon Sep 17 00:00:00 2001
|
| 2 | From: Sandro Mani <[email protected]>
|
| 3 | Date: Fri, 8 Apr 2016 23:22:12 +0200
|
| 4 | Subject: [PATCH 3/4] Fix python tests
|
| 5 | Source: https://src.fedoraproject.org/rpms/libkml/tree/master
|
| 6 |
|
| 7 | ---
|
| 8 | tests/swig/CMakeLists.txt | 6 ++++++
|
| 9 | tests/swig/kmldom_test.py | 2 +-
|
| 10 | tests/swig/kmlengine_test.py | 3 ++-
|
| 11 | 3 files changed, 9 insertions(+), 2 deletions(-)
|
| 12 |
|
| 13 | diff --git a/tests/swig/CMakeLists.txt b/tests/swig/CMakeLists.txt
|
| 14 | index 52e398e..5ba1cd1 100644
|
| 15 | |
| 16 | |
| 17 | @@ -1,12 +1,18 @@
|
| 18 | if(WITH_PYTHON)
|
| 19 | add_test(NAME test_python_kmlbase
|
| 20 | COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlbase_test.py)
|
| 21 | +set_tests_properties(test_python_kmlbase
|
| 22 | + PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
|
| 23 |
|
| 24 | add_test(NAME test_python_kmldom
|
| 25 | COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmldom_test.py)
|
| 26 | +set_tests_properties(test_python_kmldom
|
| 27 | + PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
|
| 28 |
|
| 29 | add_test(NAME test_python_kmlengine
|
| 30 | COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlengine_test.py)
|
| 31 | +set_tests_properties(test_python_kmlengine
|
| 32 | + PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
|
| 33 | endif()
|
| 34 |
|
| 35 | if(WITH_JAVA)
|
| 36 | diff --git a/tests/swig/kmldom_test.py b/tests/swig/kmldom_test.py
|
| 37 | index e18c5a7..4762d6e 100644
|
| 38 | |
| 39 | |
| 40 | @@ -753,7 +753,7 @@ def TestColorStyle(colorstyle):
|
| 41 | color = kmlbase.Color32(0xf0f0c80f)
|
| 42 | colorstyle.set_color(color)
|
| 43 | assert colorstyle.has_color()
|
| 44 | - assert color == colorstyle.get_color()
|
| 45 | + assert color.to_string_argb() == colorstyle.get_color().to_string_argb()
|
| 46 | # Clear <color> and verify has_
|
| 47 | colorstyle.clear_color()
|
| 48 | assert not colorstyle.has_color()
|
| 49 | diff --git a/tests/swig/kmlengine_test.py b/tests/swig/kmlengine_test.py
|
| 50 | index 8850221..7eb3c09 100644
|
| 51 | |
| 52 | |
| 53 | @@ -32,6 +32,7 @@ This file contains unit tests for the KML Engine Python SWIG bindings.
|
| 54 | import unittest
|
| 55 | import kmldom
|
| 56 | import kmlengine
|
| 57 | +import os
|
| 58 |
|
| 59 | # These VerySimple tests really only verify that the function/class exists.
|
| 60 |
|
| 61 | @@ -239,7 +240,7 @@ class BasicKmlFileSerializeToStringTestCase(unittest.TestCase):
|
| 62 |
|
| 63 | class BasicKmzFileTestCase(unittest.TestCase):
|
| 64 | def runTest(self):
|
| 65 | - kmz_filepath = '../../testdata/kmz/model-macky.kmz'
|
| 66 | + kmz_filepath = os.path.join(os.path.dirname(__file__), '../../testdata/kmz/model-macky.kmz')
|
| 67 | kmzfile = kmlengine.KmzFile.OpenFromFile(kmz_filepath)
|
| 68 | assert kmzfile
|
| 69 | (ok, kml) = kmzfile.ReadKml()
|
| 70 | --
|
| 71 | 2.8.1
|
| 72 |
|