@@ -18,22 +18,23 @@ if(BUILD_TESTING)
1818 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
1919 set_tests_properties (run-hsimple PROPERTIES FIXTURES_SETUP HSIMPLE)
2020 set_tests_properties (read-hsimple PROPERTIES FIXTURES_REQUIRED HSIMPLE)
21-
22- find_package (Python3 3.9 REQUIRED)
23- # Need to duplicate the import ROOT test because the PASS_REGULAR_EXPRESSION
24- # property will disable checking the exit code of the test so import ROOT
25- # might fail but ctest would not report it
26- add_test (NAME python-import-root
27- COMMAND ${Python3_EXECUTABLE} -c "import ROOT"
28- )
29- set_tests_properties (python-import-root
30- PROPERTIES ENVIRONMENT PYTHONPATH=${ROOT_LIBRARY_DIR}
31- )
32- add_test (NAME python-create-histo
33- COMMAND ${Python3_EXECUTABLE} -c "import ROOT; h = ROOT.TH1D(\" myHistoName\" ,\" h\" , 100, -5, 5); print(h.GetName());"
34- )
35- set_tests_properties (python-create-histo
36- PROPERTIES ENVIRONMENT PYTHONPATH=${ROOT_LIBRARY_DIR}
37- PASS_REGULAR_EXPRESSION "myHistoName"
38- )
21+ if (ROOT_pyroot_FOUND)
22+ find_package (Python3 3.9 REQUIRED)
23+ # Need to duplicate the import ROOT test because the PASS_REGULAR_EXPRESSION
24+ # property will disable checking the exit code of the test so import ROOT
25+ # might fail but ctest would not report it
26+ add_test (NAME python-import-root
27+ COMMAND ${Python3_EXECUTABLE} -c "import ROOT"
28+ )
29+ set_tests_properties (python-import-root
30+ PROPERTIES ENVIRONMENT PYTHONPATH=${ROOT_LIBRARY_DIR}
31+ )
32+ add_test (NAME python-create-histo
33+ COMMAND ${Python3_EXECUTABLE} -c "import ROOT; h = ROOT.TH1D(\" myHistoName\" ,\" h\" , 100, -5, 5); print(h.GetName());"
34+ )
35+ set_tests_properties (python-create-histo
36+ PROPERTIES ENVIRONMENT PYTHONPATH=${ROOT_LIBRARY_DIR}
37+ PASS_REGULAR_EXPRESSION "myHistoName"
38+ )
39+ endif ()
3940endif ()
0 commit comments