From ed324f513d2ec1aec2005c62267673c442509941 Mon Sep 17 00:00:00 2001 From: Julien Malik <julien.malik@c-s.fr> Date: Sun, 12 Jun 2011 09:03:31 +0200 Subject: [PATCH] ENH: add Python tests --- Testing/CMakeLists.txt | 1 + Testing/Python/CMakeLists.txt | 15 +++++++++++++++ Testing/Python/PythonSmoothingTest.py | 17 +++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 Testing/Python/CMakeLists.txt create mode 100644 Testing/Python/PythonSmoothingTest.py diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index 5e3f8f4c9f..553715f16c 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory(Core) +add_subdirectory(Python) add_subdirectory(QtWidget) \ No newline at end of file diff --git a/Testing/Python/CMakeLists.txt b/Testing/Python/CMakeLists.txt new file mode 100644 index 0000000000..543c04d799 --- /dev/null +++ b/Testing/Python/CMakeLists.txt @@ -0,0 +1,15 @@ +# configure the test driver +FIND_PROGRAM(OTB_TEST_DRIVER otbTestDriver PATHS ${OTB_DIR}/bin ${OTB_DIR}/../../bin DOC "Path to the otbTestDriver executable from OTB") + + +SET(TEST_DRIVER "${OTB_TEST_DRIVER}" + --add-before-env PYTHONPATH "${CMAKE_BINARY_DIR}/Code/Wrappers/SWIG" + --add-before-env ITK_AUTOLOAD_PATH "${CMAKE_BINARY_DIR}/Example/Smoothing" +) +SET(TEMP ${OTBWrapper_BINARY_DIR}/Temporary) + +ADD_TEST( NAME PythonTest1 + COMMAND ${TEST_DRIVER} Execute + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonSmoothingTest.py + ${OTB_DATA_ROOT}/Input/ToulouseExtract_WithGeom.tif + ${TEMP}/ToulouseExtract_WithGeom_ ) \ No newline at end of file diff --git a/Testing/Python/PythonSmoothingTest.py b/Testing/Python/PythonSmoothingTest.py new file mode 100644 index 0000000000..521b7c6a12 --- /dev/null +++ b/Testing/Python/PythonSmoothingTest.py @@ -0,0 +1,17 @@ +# +# Example on the use of the Smoothing +# +from sys import argv +import otbApplication + +print otbApplication.ApplicationRegistry.GetAvailableApplications() + +app = otbApplication.ApplicationRegistry.CreateApplication("Smoothing") +app.SetParameterString("in", argv[1]) + +for type in ['mean', 'gaussian', 'anidif']: + app.SetParameterString("type", type) + app.SetParameterString("out", argv[2] + type + ".tif") + app.Execute() + +print dir(app) -- GitLab