From c021c49b0b1eeafc09718c7d3facb3b713eb47e4 Mon Sep 17 00:00:00 2001 From: Uy Ha <8091245+uyha@users.noreply.github.com> Date: Mon, 14 Oct 2019 12:09:18 +0200 Subject: [PATCH] Use Python3 for test_scripts (#298) * Use Python3 for test_scripts * Update travis and cmake --- .travis.yml | 3 ++- test_scripts/CMakeLists.txt | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ec66b3f..07242b86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ os: - linux - osx -dist: trusty +dist: xenial sudo: required compiler: @@ -23,6 +23,7 @@ notifications: install: - g++ --version + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew upgrade cmake; fi - cmake --version - git clone https://github.com/HowardHinnant/date - cd date diff --git a/test_scripts/CMakeLists.txt b/test_scripts/CMakeLists.txt index f2f4c34f..0a8c2b46 100644 --- a/test_scripts/CMakeLists.txt +++ b/test_scripts/CMakeLists.txt @@ -22,11 +22,11 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -include(FindPythonInterp) +include(FindPython3) -if (${PYTHONINTERP_FOUND}) +if (${Python3_Interpreter_FOUND}) execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import pyparsing" + COMMAND ${Python3_EXECUTABLE} -c "import pyparsing" RESULT_VARIABLE PythonRESULT OUTPUT_VARIABLE PythonOUTPUT ERROR_VARIABLE PythonERROR @@ -39,21 +39,21 @@ if (${PYTHONINTERP_FOUND}) message(STATUS "Pyparsing is installed: Enabling ddl2cpp tests.") add_test(NAME sqlpp11.test.ddl2cpp.bad_will_fail - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql" "${CMAKE_CURRENT_BINARY_DIR}/fail" test) set_tests_properties(sqlpp11.test.ddl2cpp.bad_will_fail PROPERTIES WILL_FAIL 1) add_test(NAME sqlpp11.test.ddl2cpp.bad_has_parse_error - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_bad.sql" "${CMAKE_CURRENT_BINARY_DIR}/fail" test) set_tests_properties(sqlpp11.test.ddl2cpp.bad_has_parse_error PROPERTIES PASS_REGULAR_EXPRESSION "Parsing error,.*") add_test(NAME sqlpp11.test.ddl2cpp.good_succeeds - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" -fail-on-parse "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" "${CMAKE_CURRENT_BINARY_DIR}/fail" test) @@ -67,7 +67,7 @@ if (${PYTHONINTERP_FOUND}) endif() add_custom_command( OUTPUT "${sqlpp.test.generated.sample.include}.h" - COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" + COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_LIST_DIR}/../scripts/ddl2cpp" ${use_identity_naming} "${CMAKE_CURRENT_LIST_DIR}/ddl2cpp_sample_good.sql" "${sqlpp.test.generated.sample.include}"