mirror of
https://github.com/catchorg/Catch2.git
synced 2025-07-31 11:17:36 +02:00
Replace deprecated FindPythonInterp with FindPython3
fix #2755 https://cmake.org/cmake/help/v3.16/module/FindPythonInterp.html
This commit is contained in:
committed by
Chris Thrasher
parent
ac207fc90f
commit
334827eb53
@ -79,8 +79,8 @@ add_subdirectory(src)
|
|||||||
|
|
||||||
# Build tests only if requested
|
# Build tests only if requested
|
||||||
if(BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
|
if(BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
|
||||||
find_package(PythonInterp 3 REQUIRED)
|
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||||
if(NOT PYTHONINTERP_FOUND)
|
if(NOT TARGET Python3::Interpreter)
|
||||||
message(FATAL_ERROR "Python not found, but required for tests")
|
message(FATAL_ERROR "Python not found, but required for tests")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_FOLDER "tests")
|
set(CMAKE_FOLDER "tests")
|
||||||
|
@ -342,10 +342,9 @@ set_tests_properties(FilteredSection::GeneratorsDontCauseInfiniteLoop-2
|
|||||||
PASS_REGULAR_EXPRESSION "All tests passed \\(4 assertions in 1 test case\\)"
|
PASS_REGULAR_EXPRESSION "All tests passed \\(4 assertions in 1 test case\\)"
|
||||||
)
|
)
|
||||||
|
|
||||||
# AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
|
|
||||||
add_test(NAME ApprovalTests
|
add_test(NAME ApprovalTests
|
||||||
COMMAND
|
COMMAND
|
||||||
${PYTHON_EXECUTABLE}
|
Python3::Interpreter
|
||||||
${CATCH_DIR}/tools/scripts/approvalTests.py
|
${CATCH_DIR}/tools/scripts/approvalTests.py
|
||||||
$<TARGET_FILE:SelfTest>
|
$<TARGET_FILE:SelfTest>
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
@ -408,7 +407,7 @@ set_tests_properties(TagAlias PROPERTIES
|
|||||||
FAIL_REGULAR_EXPRESSION "0 matching test cases"
|
FAIL_REGULAR_EXPRESSION "0 matching test cases"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test(NAME RandomTestOrdering COMMAND ${PYTHON_EXECUTABLE}
|
add_test(NAME RandomTestOrdering COMMAND Python3::Interpreter
|
||||||
${CATCH_DIR}/tests/TestScripts/testRandomOrder.py $<TARGET_FILE:SelfTest>)
|
${CATCH_DIR}/tests/TestScripts/testRandomOrder.py $<TARGET_FILE:SelfTest>)
|
||||||
set_tests_properties(RandomTestOrdering
|
set_tests_properties(RandomTestOrdering
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
@ -417,7 +416,7 @@ set_tests_properties(RandomTestOrdering
|
|||||||
|
|
||||||
add_test(NAME CheckConvenienceHeaders
|
add_test(NAME CheckConvenienceHeaders
|
||||||
COMMAND
|
COMMAND
|
||||||
${PYTHON_EXECUTABLE} ${CATCH_DIR}/tools/scripts/checkConvenienceHeaders.py
|
Python3::Interpreter ${CATCH_DIR}/tools/scripts/checkConvenienceHeaders.py
|
||||||
)
|
)
|
||||||
set_tests_properties(CheckConvenienceHeaders
|
set_tests_properties(CheckConvenienceHeaders
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
@ -602,7 +601,7 @@ if(CATCH_ENABLE_CONFIGURE_TESTS)
|
|||||||
"ExperimentalRedirect")
|
"ExperimentalRedirect")
|
||||||
add_test(NAME "CMakeConfig::${testName}"
|
add_test(NAME "CMakeConfig::${testName}"
|
||||||
COMMAND
|
COMMAND
|
||||||
"${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/TestScripts/testConfigure${testName}.py" "${CATCH_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
|
Python3::Interpreter "${CMAKE_CURRENT_LIST_DIR}/TestScripts/testConfigure${testName}.py" "${CATCH_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
set_tests_properties("CMakeConfig::${testName}"
|
set_tests_properties("CMakeConfig::${testName}"
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
@ -615,7 +614,7 @@ endif()
|
|||||||
if(CATCH_ENABLE_CMAKE_HELPER_TESTS)
|
if(CATCH_ENABLE_CMAKE_HELPER_TESTS)
|
||||||
add_test(NAME "CMakeHelper::DiscoverTests"
|
add_test(NAME "CMakeHelper::DiscoverTests"
|
||||||
COMMAND
|
COMMAND
|
||||||
"${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/TestScripts/DiscoverTests/VerifyRegistration.py" "${CATCH_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
|
Python3::Interpreter "${CMAKE_CURRENT_LIST_DIR}/TestScripts/DiscoverTests/VerifyRegistration.py" "${CATCH_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
set_tests_properties("CMakeHelper::DiscoverTests"
|
set_tests_properties("CMakeHelper::DiscoverTests"
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
|
@ -5,7 +5,7 @@ message(STATUS "Extra tests included")
|
|||||||
|
|
||||||
add_test(
|
add_test(
|
||||||
NAME TestShardingIntegration
|
NAME TestShardingIntegration
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tests/TestScripts/testSharding.py $<TARGET_FILE:SelfTest>
|
COMMAND Python3::Interpreter ${CATCH_DIR}/tests/TestScripts/testSharding.py $<TARGET_FILE:SelfTest>
|
||||||
)
|
)
|
||||||
set_tests_properties(TestShardingIntegration
|
set_tests_properties(TestShardingIntegration
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
@ -114,7 +114,7 @@ target_compile_definitions(BazelReporter PRIVATE CATCH_CONFIG_BAZEL_SUPPORT)
|
|||||||
target_link_libraries(BazelReporter Catch2_buildall_interface)
|
target_link_libraries(BazelReporter Catch2_buildall_interface)
|
||||||
add_test(NAME CATCH_CONFIG_BAZEL_REPORTER-1
|
add_test(NAME CATCH_CONFIG_BAZEL_REPORTER-1
|
||||||
COMMAND
|
COMMAND
|
||||||
"${PYTHON_EXECUTABLE}" "${CATCH_DIR}/tests/TestScripts/testBazelReporter.py" $<TARGET_FILE:BazelReporter> "${CMAKE_CURRENT_BINARY_DIR}"
|
Python3::Interpreter "${CATCH_DIR}/tests/TestScripts/testBazelReporter.py" $<TARGET_FILE:BazelReporter> "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
set_tests_properties(CATCH_CONFIG_BAZEL_REPORTER-1
|
set_tests_properties(CATCH_CONFIG_BAZEL_REPORTER-1
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
@ -126,7 +126,7 @@ add_executable(BazelReporterNoCatchConfig ${TESTS_DIR}/X30-BazelReporter.cpp)
|
|||||||
target_link_libraries(BazelReporterNoCatchConfig Catch2WithMain)
|
target_link_libraries(BazelReporterNoCatchConfig Catch2WithMain)
|
||||||
add_test(NAME NO_CATCH_CONFIG_BAZEL_REPORTER-1
|
add_test(NAME NO_CATCH_CONFIG_BAZEL_REPORTER-1
|
||||||
COMMAND
|
COMMAND
|
||||||
"${PYTHON_EXECUTABLE}" "${CATCH_DIR}/tests/TestScripts/testBazelReporter.py" $<TARGET_FILE:BazelReporterNoCatchConfig> "${CMAKE_CURRENT_BINARY_DIR}"
|
Python3::Interpreter "${CATCH_DIR}/tests/TestScripts/testBazelReporter.py" $<TARGET_FILE:BazelReporterNoCatchConfig> "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
set_tests_properties(NO_CATCH_CONFIG_BAZEL_REPORTER-1
|
set_tests_properties(NO_CATCH_CONFIG_BAZEL_REPORTER-1
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
@ -146,7 +146,7 @@ set_tests_properties(BazelEnv::TESTBRIDGE_TEST_ONLY
|
|||||||
|
|
||||||
add_test(NAME BazelEnv::Sharding
|
add_test(NAME BazelEnv::Sharding
|
||||||
COMMAND
|
COMMAND
|
||||||
"${PYTHON_EXECUTABLE}" "${CATCH_DIR}/tests/TestScripts/testBazelSharding.py"
|
Python3::Interpreter "${CATCH_DIR}/tests/TestScripts/testBazelSharding.py"
|
||||||
$<TARGET_FILE:BazelReporterNoCatchConfig>
|
$<TARGET_FILE:BazelReporterNoCatchConfig>
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
@ -222,7 +222,7 @@ add_executable(PartialTestCaseEvents ${TESTS_DIR}/X21-PartialTestCaseEvents.cpp)
|
|||||||
target_link_libraries(PartialTestCaseEvents PRIVATE Catch2WithMain)
|
target_link_libraries(PartialTestCaseEvents PRIVATE Catch2WithMain)
|
||||||
add_test(
|
add_test(
|
||||||
NAME PartialTestCaseEvents
|
NAME PartialTestCaseEvents
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tests/TestScripts/testPartialTestCaseEvent.py $<TARGET_FILE:PartialTestCaseEvents>
|
COMMAND Python3::Interpreter ${CATCH_DIR}/tests/TestScripts/testPartialTestCaseEvent.py $<TARGET_FILE:PartialTestCaseEvents>
|
||||||
)
|
)
|
||||||
set_tests_properties(PartialTestCaseEvents
|
set_tests_properties(PartialTestCaseEvents
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
|
Reference in New Issue
Block a user