Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Allow overriding of Python interpreter

* Calling `python` does not allow overriding
  downstream when running tests.
Commit
7f18282d178505072a059b5318543a245a924496
Author
David Seifert ·
Committer
Martin Hořeňovský
Parents
1cdaa48a0b20

Files · Download .tar.gz

Changes

 CMakeLists.txt          | 4 ++++
 projects/CMakeLists.txt | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94f90d9f..56d55298 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,7 +36,11 @@ if(USE_WMAIN)
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
 endif()
 
+find_package(PythonInterp)
 if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
+    if (NOT PYTHONINTERP_FOUND)
+        message(FATAL_ERROR "Python not found, but required for tests")
+    endif()
     add_subdirectory(projects)
 endif()
 
diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt
index 70aca2f2..9fd2210f 100644
--- a/projects/CMakeLists.txt
+++ b/projects/CMakeLists.txt
@@ -319,7 +319,7 @@ add_test(NAME NoTest COMMAND $<TARGET_FILE:SelfTest> -w NoTests "___nonexistent_
 set_tests_properties(NoTest PROPERTIES PASS_REGULAR_EXPRESSION "No test cases matched")
 
 # AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
-add_test(NAME ApprovalTests COMMAND python ${CATCH_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
+add_test(NAME ApprovalTests COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
 set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
 
 if (CATCH_USE_VALGRIND)