提交 21be601b 编写于 作者: Q qingqing01 提交者: GitHub

Merge pull request #2268 from reyoung/feature/fix_bug_in_run_python_tests

Fix bug in run_python_tests.sh
...@@ -149,8 +149,9 @@ endfunction() ...@@ -149,8 +149,9 @@ endfunction()
# Create a python unittest using run_python_tests.sh, # Create a python unittest using run_python_tests.sh,
# which takes care of making correct running environment # which takes care of making correct running environment
function(add_python_test TEST_NAME) function(add_python_test TEST_NAME)
add_test(NAME ${TEST_NAME} add_test(NAME ${TEST_NAME}
COMMAND bash ${PROJ_ROOT}/paddle/scripts/run_python_tests.sh COMMAND env PADDLE_PACKAGE_DIR=${PADDLE_PYTHON_PACKAGE_DIR}
bash ${PROJ_ROOT}/paddle/scripts/run_python_tests.sh
${USE_VIRTUALENV_FOR_TEST} ${PYTHON_EXECUTABLE} ${ARGN} ${USE_VIRTUALENV_FOR_TEST} ${PYTHON_EXECUTABLE} ${ARGN}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endfunction() endfunction()
...@@ -24,12 +24,21 @@ PYTHON=$1; shift ...@@ -24,12 +24,21 @@ PYTHON=$1; shift
if [ $USE_VIRTUALENV_FOR_TEST -ne 0 ]; then if [ $USE_VIRTUALENV_FOR_TEST -ne 0 ]; then
rm -rf .test_env rm -rf .test_env
virtualenv .test_env virtualenv .test_env
unset PYTHONHOME
unset PYTHONPATH
source .test_env/bin/activate source .test_env/bin/activate
PYTHON=python PYTHON=python
fi fi
export PYTHONPATH=$SCRIPTPATH/../../python/ $PYTHON -m pip install $SCRIPTPATH/../dist/*.whl
$PYTHON -m pip install $SCRIPTPATH/../dist/*.whl requests matplotlib opencv-python ipython==5.3 rarfile
if [ "X${PADDLE_PACKAGE_DIR}" != "X" ]; then
$PYTHON -m pip install ${PADDLE_PACKAGE_DIR}/*.whl
else
export PYTHONPATH=$SCRIPTPATH/../../python/
fi
$PYTHON -m pip install ipython==5.3
for fn in "$@" for fn in "$@"
do do
......
...@@ -23,7 +23,9 @@ add_custom_command(OUTPUT ${OUTPUT_DIR}/.timestamp ...@@ -23,7 +23,9 @@ add_custom_command(OUTPUT ${OUTPUT_DIR}/.timestamp
add_custom_target(paddle_python ALL DEPENDS add_custom_target(paddle_python ALL DEPENDS
${OUTPUT_DIR}/.timestamp) ${OUTPUT_DIR}/.timestamp)
set(PADDLE_PYTHON_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/dist/)
add_subdirectory(paddle/trainer_config_helpers/tests) add_subdirectory(paddle/trainer_config_helpers/tests)
if (WITH_SWIG_PY) if (WITH_SWIG_PY)
# enable v2 API unittest only when paddle swig api is compiled # enable v2 API unittest only when paddle swig api is compiled
add_subdirectory(paddle/v2/tests) add_subdirectory(paddle/v2/tests)
...@@ -31,6 +33,6 @@ if (WITH_SWIG_PY) ...@@ -31,6 +33,6 @@ if (WITH_SWIG_PY)
add_subdirectory(paddle/v2/plot/tests) add_subdirectory(paddle/v2/plot/tests)
endif() endif()
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dist/ install(DIRECTORY ${PADDLE_PYTHON_PACKAGE_DIR}
DESTINATION opt/paddle/share/wheels DESTINATION opt/paddle/share/wheels
) )
add_python_test(test_ploter test_ploter.py) if (NOT APPLE)
# The Mac OS X backend will not be able to function correctly if Python is
# not installed as a framework.
add_python_test(test_ploter test_ploter.py)
endif()
...@@ -19,6 +19,7 @@ setup(name='paddle', ...@@ -19,6 +19,7 @@ setup(name='paddle',
"numpy", "numpy",
"protobuf==${PROTOBUF_VERSION}", "protobuf==${PROTOBUF_VERSION}",
"matplotlib", "matplotlib",
"opencv-python",
"rarfile" "rarfile"
], ],
packages=packages, packages=packages,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册