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 d5df842b12
commit aa586a9819

View File

@ -88,7 +88,7 @@ endif()
# Make sure pytest is found or produce a fatal error
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)
if(PYBIND11_EXEC_PYTHON_ERR)
message(FATAL_ERROR "Running the tests requires pytest. Please install it manually (try: ${PYTHON_EXECUTABLE} -m pip install pytest)")