Skip to content

Commit 748fdbb

Browse files
authored
Merge pull request #5906 from Yancey1989/fix_py_unit_test_executable
py unit test should use correct executable file
2 parents 0690cca + cd29714 commit 748fdbb

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

cmake/generic.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ function(py_test TARGET_NAME)
463463
cmake_parse_arguments(py_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
464464
add_test(NAME ${TARGET_NAME}
465465
COMMAND env PYTHONPATH=${PADDLE_PYTHON_BUILD_DIR}/lib-python
466-
python2 ${py_test_SRCS}
466+
${PYTHON_EXECUTABLE} ${py_test_SRCS}
467467
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
468468
endif()
469469
endfunction()

cmake/util.cmake

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,3 @@ function(create_resources res_file output_file)
168168
COMMAND python ARGS ${PADDLE_SOURCE_DIR}/cmake/make_resource.py ${res_file} ${output_file}
169169
DEPENDS ${res_file} ${PADDLE_SOURCE_DIR}/cmake/make_resource.py)
170170
endfunction()
171-
172-
173-
# Create a python unittest using run_python_tests.sh,
174-
# which takes care of making correct running environment
175-
function(add_python_test TEST_NAME)
176-
foreach(arg ${ARGN})
177-
get_filename_component(py_fn ${arg} NAME_WE)
178-
set(TRG_NAME ${TEST_NAME}_${py_fn})
179-
add_test(NAME ${TRG_NAME}
180-
COMMAND env PYTHONPATH=${PADDLE_PYTHON_PACKAGE_DIR}
181-
python2 ${arg}
182-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
183-
endforeach()
184-
endfunction()

0 commit comments

Comments
 (0)