Commit 96e4410d authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Add tests with NumPy only when NumPy is found.

Also removed TestNumPy.cmake. One should use the newer
find_python_module() API instead.

Change-Id: Ie40ede812a2d819d6e5e0214d823a82a2964243a
parent 519b6803
......@@ -14,8 +14,8 @@ paraview_test_load_data(""
)
# only enable TestPythonAnnotationFilter test if numpy is available
include(TestNumPy)
if (FOUND_NUMPY)
find_python_module(numpy numpy_found)
if (numpy_found)
set(PARAVIEW_PYTHON_ARGS
--data=${PARAVIEW_TEST_OUTPUT_DATA_DIR}/can.ex2)
# Add pvpython tests
......
......@@ -253,7 +253,6 @@ SET (TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/TensorGlyph.xml
${CMAKE_CURRENT_SOURCE_DIR}/TemporalInterpolator.xml
${CMAKE_CURRENT_SOURCE_DIR}/TemporalShiftScale.xml
${CMAKE_CURRENT_SOURCE_DIR}/TestFindDataMax.xml
${CMAKE_CURRENT_SOURCE_DIR}/Tessellate.xml
${CMAKE_CURRENT_SOURCE_DIR}/Threshold.xml
${CMAKE_CURRENT_SOURCE_DIR}/UndoRedo.xml
......@@ -309,6 +308,14 @@ if(PARAVIEW_ENABLE_PYTHON)
if (PARAVIEW_ENABLE_MATPLOTLIB AND matplotlib_found)
list(APPEND TESTS_WITH_BASELINES ${CMAKE_CURRENT_SOURCE_DIR}/TestPythonView.xml)
endif()
find_python_module(numpy numpy_found)
if (numpy_found)
list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/TestFindDataMax.xml)
list(APPEND TESTS_WITH_INLINE_COMPARES
${CMAKE_CURRENT_SOURCE_DIR}/FindDataDialog.xml)
endif()
endif()
#------------------------------------------------------------------------------
......@@ -366,14 +373,6 @@ endif()
set(ProbePicking_DISABLE_CRS TRUE)
set(ProbePicking_THRESHOLD 120)
# only enable find data tests if numpy is available
include("TestNumPy")
IF ("1" STREQUAL ${HAS_NUMPY})
SET(TESTS_WITH_INLINE_COMPARES ${TESTS_WITH_INLINE_COMPARES}
${CMAKE_CURRENT_SOURCE_DIR}/FindDataDialog.xml)
ENDIF ("1" STREQUAL ${HAS_NUMPY})
#------------------------------------------------------------------------------
set (TestPythonConsole_BREAK TRUE)
......
# This script detects whether numpy is present in the system
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE}
-c
"
import os
import sys
# prevents dashboard from truncating output of this test.
# print >> sys.stderr, \"Enabling CTEST_FULL_OUTPUT\"
# print >> sys.stderr, \"Checking NUMPY...\"
try:
import numpy
numpy.__version__
# print >> sys.stderr, numpy.__version__
# print >> sys.stderr, \"----> import numpy WORKS!\"
except ImportError:
# print >> sys.stderr, \"----> import numpy FAILED.\"
os._exit(0)
os._exit(1)
"
RESULT_VARIABLE HAS_NUMPY
)
# Doing the HAS_NUMPY string comparison everytime is annoying. Hence setting up
# this FOUND_NUMPY variable.
set (FOUND_NUMPY FALSE)
if ("1" STREQUAL ${HAS_NUMPY})
set (FOUND_NUMPY TRUE)
endif()
......@@ -16,8 +16,6 @@ paraview_test_load_data(""
###############################################################################
# For python scripts for testing.
#
include (TestNumPy)
# Add python script names here.
set(PY_TESTS
Animation.py
......@@ -41,10 +39,13 @@ set(PY_TESTS
ValidateSources.py,NO_VALID
ColorAttributeTypeBackwardsCompatibility.py,NO_VALID
)
if (FOUND_NUMPY)
list(APPEND PY_TESTS
PythonSelection.py)
include(FindPythonModules)
find_python_module(numpy numpy_found)
if (numpy_found)
list(APPEND PY_TESTS PythonSelection.py)
endif ()
if (BUILD_SHARED_LIBS
AND PARAVIEW_BUILD_PLUGIN_SurfaceLIC
AND PARAVIEW_BUILD_PLUGIN_SLACTools)
......@@ -105,7 +106,7 @@ else ()
set(vtk_test_prefix)
endif ()
IF ("1" STREQUAL ${HAS_NUMPY})
if (numpy_found)
# This is necessary because PythonFilters generates and executes python scripts
# on the fly which throws exceptions but cannot be caught by the host script
# for some reason. Therefore, those exceptions are not considered as failures
......@@ -120,7 +121,7 @@ IF ("1" STREQUAL ${HAS_NUMPY})
# set_tests_properties(${vtk-module}Python-MPI-SymmetricPythonFilters PROPERTIES FAIL_REGULAR_EXPRESSION "Error")
# set_tests_properties(${vtk-module}Python-PythonFilters PROPERTIES FAIL_REGULAR_EXPRESSION "Error")
# set_tests_properties(${vtk-module}Python-SymmetricPythonFilters PROPERTIES FAIL_REGULAR_EXPRESSION "Error")
ENDIF ("1" STREQUAL ${HAS_NUMPY})
endif()
if (PARAVIEW_USE_MPI AND VTK_MPIRUN_EXE AND NOT WIN32)
set(PARAVIEW_PVBATCH_ARGS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment