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