diff --git a/cmake/generic.cmake b/cmake/generic.cmake index 67a756faec97bd5526248d37e188922973113718..ba86cfabdf173467973b9d4337e6edbbe84c5889 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -797,7 +797,8 @@ function(py_test TARGET_NAME) if(WITH_COVERAGE AND NOT (WITH_INCREMENTAL_COVERAGE AND "$ENV{PADDLE_GIT_DIFF_PY_FILE}" STREQUAL "")) add_test(NAME ${TARGET_NAME} COMMAND ${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true FLAGS_cudnn_deterministic=true - FLAGS_cpu_deterministic=true ${py_test_ENVS} + FLAGS_cpu_deterministic=true + PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_ENVS} COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data ${PYTHON_EXECUTABLE} -m coverage run --branch -p ${py_test_SRCS} ${py_test_ARGS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})