60d68cd
From b728c0815edc06c826fb5be8cd25cbb7f3b816b3 Mon Sep 17 00:00:00 2001
60d68cd
From: Sandro Mani <manisandro@gmail.com>
60d68cd
Date: Fri, 8 Apr 2016 23:22:12 +0200
60d68cd
Subject: [PATCH 3/4] Fix python tests
60d68cd
60d68cd
---
60d68cd
 tests/swig/CMakeLists.txt    | 6 ++++++
60d68cd
 tests/swig/kmldom_test.py    | 2 +-
60d68cd
 tests/swig/kmlengine_test.py | 3 ++-
60d68cd
 3 files changed, 9 insertions(+), 2 deletions(-)
60d68cd
60d68cd
diff --git a/tests/swig/CMakeLists.txt b/tests/swig/CMakeLists.txt
60d68cd
index 52e398e..5ba1cd1 100644
60d68cd
--- a/tests/swig/CMakeLists.txt
60d68cd
+++ b/tests/swig/CMakeLists.txt
60d68cd
@@ -1,12 +1,18 @@
60d68cd
 if(WITH_PYTHON)
60d68cd
 add_test(NAME test_python_kmlbase
60d68cd
   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlbase_test.py)
60d68cd
+set_tests_properties(test_python_kmlbase
60d68cd
+     PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
60d68cd
 
60d68cd
 add_test(NAME test_python_kmldom
60d68cd
   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmldom_test.py)
60d68cd
+set_tests_properties(test_python_kmldom
60d68cd
+     PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
60d68cd
 
60d68cd
 add_test(NAME test_python_kmlengine
60d68cd
   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kmlengine_test.py)
60d68cd
+set_tests_properties(test_python_kmlengine
60d68cd
+     PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_BINARY_DIR}/src/swig:${CMAKE_BINARY_DIR}/lib")
60d68cd
 endif()
60d68cd
 
60d68cd
 if(WITH_JAVA)
60d68cd
diff --git a/tests/swig/kmldom_test.py b/tests/swig/kmldom_test.py
60d68cd
index e18c5a7..4762d6e 100644
60d68cd
--- a/tests/swig/kmldom_test.py
60d68cd
+++ b/tests/swig/kmldom_test.py
60d68cd
@@ -753,7 +753,7 @@ def TestColorStyle(colorstyle):
60d68cd
   color = kmlbase.Color32(0xf0f0c80f)
60d68cd
   colorstyle.set_color(color)
60d68cd
   assert colorstyle.has_color()
60d68cd
-  assert color == colorstyle.get_color()
60d68cd
+  assert color.to_string_argb() == colorstyle.get_color().to_string_argb()
60d68cd
   # Clear <color> and verify has_
60d68cd
   colorstyle.clear_color()
60d68cd
   assert not colorstyle.has_color()
60d68cd
diff --git a/tests/swig/kmlengine_test.py b/tests/swig/kmlengine_test.py
60d68cd
index 8850221..7eb3c09 100644
60d68cd
--- a/tests/swig/kmlengine_test.py
60d68cd
+++ b/tests/swig/kmlengine_test.py
60d68cd
@@ -32,6 +32,7 @@ This file contains unit tests for the KML Engine Python SWIG bindings.
60d68cd
 import unittest
60d68cd
 import kmldom
60d68cd
 import kmlengine
60d68cd
+import os
60d68cd
 
60d68cd
 # These VerySimple tests really only verify that the function/class exists.
60d68cd
 
60d68cd
@@ -239,7 +240,7 @@ class BasicKmlFileSerializeToStringTestCase(unittest.TestCase):
60d68cd
 
60d68cd
 class BasicKmzFileTestCase(unittest.TestCase):
60d68cd
   def runTest(self):
60d68cd
-    kmz_filepath = '../../testdata/kmz/model-macky.kmz'
60d68cd
+    kmz_filepath = os.path.join(os.path.dirname(__file__), '../../testdata/kmz/model-macky.kmz')
60d68cd
     kmzfile = kmlengine.KmzFile.OpenFromFile(kmz_filepath)
60d68cd
     assert kmzfile
60d68cd
     (ok, kml) = kmzfile.ReadKml()
60d68cd
-- 
60d68cd
2.8.1
60d68cd