use a more conservative mechanism to check for pytest

On a debian jessie machine, running 'python --version --noconftest' caused
pytest to try and run the test suite with the not-yet-compiled extension
module, thus failing the test. This commit chages the pytest detection
so that it only attempts to run an import statement.
This commit is contained in:
Wenzel Jakob 2017-01-04 08:00:14 -05:00
parent 5f07facef5
commit 0e49c02213
1 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,7 @@ endif()
# Make sure pytest is found or produce a fatal error # Make sure pytest is found or produce a fatal error
if(NOT PYBIND11_PYTEST_FOUND) if(NOT PYBIND11_PYTEST_FOUND)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pytest --version --noconftest OUTPUT_QUIET ERROR_QUIET execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pytest" OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE PYBIND11_EXEC_PYTHON_ERR) RESULT_VARIABLE PYBIND11_EXEC_PYTHON_ERR)
if(PYBIND11_EXEC_PYTHON_ERR) if(PYBIND11_EXEC_PYTHON_ERR)
message(FATAL_ERROR "Running the tests requires pytest. Please install it manually (try: ${PYTHON_EXECUTABLE} -m pip install pytest)") message(FATAL_ERROR "Running the tests requires pytest. Please install it manually (try: ${PYTHON_EXECUTABLE} -m pip install pytest)")