Skip to content

Commit ea3c012

Browse files
committed
[CMake][NFC] Simplify cmake code for test fixtures.
1 parent d44821a commit ea3c012

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

cmake/modules/RootMacros.cmake

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,18 +1652,14 @@ function(ROOT_ADD_TEST test)
16521652
set_tests_properties(${test} PROPERTIES LABELS "${ARG_LABELS}")
16531653
endif()
16541654

1655-
if(ARG_PYTHON_DEPS)
1656-
foreach(python_dep ${ARG_PYTHON_DEPS})
1657-
if(NOT TEST test-import-${python_dep})
1658-
add_test(NAME test-import-${python_dep} COMMAND ${PYTHON_EXECUTABLE_Development_Main} -c "import ${python_dep}")
1659-
set_tests_properties(test-import-${python_dep} PROPERTIES FIXTURES_SETUP requires_${python_dep})
1660-
endif()
1661-
list(APPEND fixtures "requires_${python_dep}")
1662-
endforeach()
1663-
if(fixtures)
1664-
set_tests_properties(${test} PROPERTIES FIXTURES_REQUIRED "${fixtures}")
1655+
foreach(python_dep ${ARG_PYTHON_DEPS})
1656+
set(fixture_name requires_${python_dep})
1657+
set_property(TEST ${test} APPEND PROPERTY FIXTURES_REQUIRED ${fixture_name})
1658+
if(NOT TEST test-import-${python_dep})
1659+
add_test(NAME test-import-${python_dep} COMMAND ${PYTHON_EXECUTABLE_Development_Main} -c "import ${python_dep}")
1660+
set_tests_properties(test-import-${python_dep} PROPERTIES FIXTURES_SETUP ${fixture_name})
16651661
endif()
1666-
endif()
1662+
endforeach()
16671663

16681664
if(ARG_RUN_SERIAL)
16691665
set_property(TEST ${test} PROPERTY RUN_SERIAL true)

0 commit comments

Comments
 (0)