test.python.cmake
Go to the documentation of this file.
1 # Tests that require python
2 
3 list(APPEND TESTS_WITHOUT_BASELINES
4  FullNotation.xml
5  IconBrowser.xml
6  MacroEditor.xml
7  MultipleNumberOfComponents.xml
8  ProgrammableSourcePythonEditorLink.xml
9  PythonDefaultLoadState.xml
10  PythonDefaultSaveState.xml
11  PythonEditorTab.xml
12  PythonResetSessionMacro.xml
13  SpreadSheetNullArrayName.xml # needs programmable filter
14  # TestPopOutWidget.xml
15  TestPythonConsole.xml
16  TraceIntegrateVariables.xml
17  )
18 
19 # This test rely on copy being Ctrl-C
20 if(NOT APPLE)
21  list(APPEND TESTS_WITHOUT_BASELINES
22  TooltipCopy.xml
23  TestHTGHoverOnCell.xml
24  )
25 endif()
26 
27 # VTTKJS exporter requires the Web module
28 if (PARAVIEW_ENABLE_WEB)
29  list (APPEND TESTS_WITHOUT_BASELINES
30  ExportToVTKJS.xml
31  ExportToVTKJSWithArraySelection.xml
32  )
33  set (ExportToVTKJS_FORCE_SERIAL TRUE) # since this uses popup-menu
34 endif ()
35 
36 list(APPEND TESTS_WITH_BASELINES
37  AutoSaveState.xml
38  ColorByComponentNames.xml # needs programmable filter
39  LiveProgrammableSource.xml
40  LinkRenderViews.xml
41  LinkViews.xml
42  PythonShellRunScript.xml
43  PythonEditorRun.xml
44  SaveLoadStatePython.xml
45  SaveLoadStateSelectionPython.xml
46  TraceExodus.xml
47  TraceExportAndSaveData.xml
48  TraceSaveGeometry.xml
49  # TraceStatisticsFilter.xml (see paraview/paraview#20661. Also was disabled in CS/CRS mode)
50  TraceSupplementalProxiesFully.xml
51  TraceTimeControls.xml
52  TraceWithoutRenderingComponents.xml
53  )
54 # Surface selection unstable on CRS mode
55 set(SaveLoadStateSelectionPython_DISABLE_CRS TRUE)
56 
57 set (AutoSaveState_FORCE_SERIAL TRUE) # since this modifies settings
58 
59 list(APPEND TESTS_WITH_INLINE_COMPARES
60  RestoreArrayDefaultTransferFunction.xml
61  RestoreDefaultTransferFunction.xml
62  SelectCellsTrace.xml
63  SelectionLinkScripting.xml
64  SelectPointsTrace.xml
65  SplitViewTrace.xml
66  TraceMultiViews.xml
67  )
68 set(SelectCellsTrace_DISABLE_CRS TRUE)
69 set(SelectPointsTrace_DISABLE_CRS TRUE)
70 
71 # Check that matplotlib is available
72 include(ParaViewFindPythonModules)
73 find_python_module(matplotlib matplotlib_found)
74 if (matplotlib_found)
75  list(APPEND TESTS_WITH_BASELINES TestPythonView.xml)
76  list(APPEND TESTS_WITH_INLINE_COMPARES TextSourceInteriorLines.xml)
77  list(APPEND TESTS_WITH_INLINE_COMPARES TextSourcesInChartViews.xml)
78  list(APPEND TESTS_WITH_INLINE_COMPARES MathTextColumn.xml)
79 endif()
80 
81 find_python_module(numpy numpy_found)
82 if (numpy_found)
83  list(APPEND TESTS_WITH_BASELINES
84  AnnotateNotSanitizedArray.xml
85  ContextViewSelectionTrace.xml
86  FindDataNameSanitization.xml
87  FindDataNonDistributedData.xml
88  FindDataPartialArrays.xml
89  FindDataSelectLocationMultiblock.xml # find data needs python/numpy
90  FindDataSelectLocation.xml # find data needs python/numpy
91  FindDataSelectors.xml
92  FindDataTime.xml
93  ForceTimeDiamond.xml
94  FreezeQueryMultiblock.xml
95  IndexedLookupInitialization.xml # needs Python Calculator/numpy
96  PlotOverLine_surface.xml # needs find data
97  ProgrammableAnnotation.xml
98  SpreadSheetSelectionTrace.xml
99  StructuredGridCellBlanking.xml
100  VolumeNoMapScalars.xml # needs programmable filter + numpy
101  )
102 
103  list(APPEND TESTS_WITHOUT_BASELINES
104  ExpressionChooser.xml
105  ExpressionClear.xml
106  FieldDataDomainDefault.xml
107  HyperTreeGridGenerateFields.xml
108  HTGPlotSelectionOverTime.xml
109  PlotOverLine_htg.xml # needs find data
110  ProgrammableFilterFieldData.xml
111  PythonCalculator.xml
112  PythonCalculatorArrayAssociation.xml
113  PythonCalculatorAutocomplete.xml
114  PythonCalculatorCrossComposite.xml
115  PythonCalculatorFieldData.xml
116  PythonCalculatorInput.xml
117  PythonCalculatorMultiline.xml
118  SelectionAndAutoSaveState.xml
119  )
120 
121  set(SpreadSheetSelectionTrace_DISABLE_CS TRUE)
122  set(SpreadSheetSelectionTrace_DISABLE_CRS TRUE)
123 
124  list(APPEND TESTS_WITH_INLINE_COMPARES
125  ExodusModeShapes.xml
126  FindDataTrace.xml
127  FindDataQueries.xml
128  TestTableFFT.xml # needs programmable filter + numpy
129  )
130 
131  # PythonAlgorithm plugin tests.
132  configure_file(
133  "PythonAlgorithmPlugin.xml.in"
134  "${CMAKE_CURRENT_BINARY_DIR}/PythonAlgorithmPlugin.xml" @ONLY)
135  configure_file(
136  "PythonAlgorithmReadersAndWriters.xml.in"
137  "${CMAKE_CURRENT_BINARY_DIR}/PythonAlgorithmReadersAndWriters.xml" @ONLY)
138 
139  set(pyalgo_plugin_tests
140  PythonAlgorithmPlugin
141  PythonAlgorithmReadersAndWriters)
142  foreach(tname IN LISTS pyalgo_plugin_tests)
143  list(APPEND TESTS_WITH_BASELINES
144  ${CMAKE_CURRENT_BINARY_DIR}/${tname}.xml)
145 
146  # we need to extend testing infrastructure to better support
147  # loading plugins in client-server. At that point, we can test these as well.
148  set(${tname}_DISABLE_CS TRUE)
149  set(${tname}_DISABLE_CRS TRUE)
150  endforeach()
151 endif()
152 
153 #----------------------------------------------------------------------
154 # Tests that produce some output (other than rendered images) from ParaView
155 # that should be checked for correctness. These work by executing an XML
156 # test in the UI that produces some output, then pvpython runs a Python script
157 # that checks the file for correctness. Example use: checking a CSV
158 # file for expected content.
159 #
160 # Tests listed here are required to define the following files:
161 # - <test>.xml - XML test script to play in the uI
162 # - <test>Verify.py - Python code to verify output saved out in the XML
163 # script
164 #----------------------------------------------------------------------
165 set(paraview_python_verify_tests
166  ExportMultiblockFieldDataSpreadsheet
167  ExportSceneSpreadSheetView
168 )
169 
170 if (PARAVIEW_ENABLE_WEB)
171  list(APPEND paraview_python_verify_tests
172  AnimatedExportScene
173  )
174 endif()
175 
176 if (PARAVIEW_USE_PYTHON)
177  foreach(test_name ${paraview_python_verify_tests})
178  set(tname "ParaView::Applications::${test_name}")
179  add_test(NAME ${tname}
180  COMMAND ${CMAKE_COMMAND}
181  -DPARAVIEW_EXECUTABLE:FILEPATH=$<TARGET_FILE:ParaView::paraview>
182  -DPVPYTHON_EXECUTABLE:FILEPATH=$<TARGET_FILE:ParaView::pvpython>
183  -DDATA_DIR:PATH=${paraview_test_data_directory_output}
184  -DTEST_NAME:STRING=${test_name}
185  -DTEST_SCRIPT:FILEPATH=${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.xml
186  -DTEST_VERIFIER:FILEPATH=${CMAKE_CURRENT_SOURCE_DIR}/${test_name}Verify.py
187  -DTEMPORARY_DIR:PATH=${CMAKE_BINARY_DIR}/Testing/Temporary
188  -P ${CMAKE_CURRENT_SOURCE_DIR}/PythonScriptTestDriver.cmake
189  )
190  set_tests_properties(${tname} PROPERTIES LABELS "paraview")
191  endforeach()
192 endif()
data
function find_python_module(module_name, result)