From 9ad57f2dfdd75bbf8f3b4eba96043ea6971d970d Mon Sep 17 00:00:00 2001 From: kh2se2013 Date: Fri, 12 Jul 2019 10:30:14 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=89change=20to=20parallel=20mode=20on=20?= =?UTF-8?q?python=20coverage=20run=20(#18594)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2)add pip install coverage in Dockerfile.tmp test=develop --- cmake/generic.cmake | 2 +- paddle/scripts/Dockerfile.tmp | 6 ++++++ python/paddle/fluid/tests/unittests/CMakeLists.txt | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/generic.cmake b/cmake/generic.cmake index b8f92542128..d846e08b3c3 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -728,7 +728,7 @@ function(py_test TARGET_NAME) FLAGS_cpu_deterministic=true FLAGS_limit_of_tmp_allocation=4294967296 # 4G PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_ENVS} COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data - ${PYTHON_EXECUTABLE} -m coverage run -a --branch ${py_test_SRCS} ${py_test_ARGS} + ${PYTHON_EXECUTABLE} -m coverage run --branch -p ${py_test_SRCS} ${py_test_ARGS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) else() add_test(NAME ${TARGET_NAME} diff --git a/paddle/scripts/Dockerfile.tmp b/paddle/scripts/Dockerfile.tmp index d75d1552cac..db5060944ff 100644 --- a/paddle/scripts/Dockerfile.tmp +++ b/paddle/scripts/Dockerfile.tmp @@ -138,6 +138,12 @@ RUN pip --no-cache-dir install requests==2.9.2 numpy protobuf \ recordio matplotlib==2.2.3 rarfile scipy Pillow \ nltk graphviz six funcsigs pyyaml decorator prettytable +# for coverage +RUN pip3 --no-cache-dir install coverage +RUN pip3.6 --no-cache-dir install coverage +RUN pip3.7 --no-cache-dir install coverage +RUN pip --no-cache-dir install coverage + # To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use # the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2 RUN apt-get install -y libssl-dev libffi-dev && apt-get clean -y diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index 57ec8cb8481..ecd40dc6ede 100644 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -79,7 +79,7 @@ function(py_test_modules TARGET_NAME) add_test(NAME ${TARGET_NAME} COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_modules_ENVS} COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data - ${PYTHON_EXECUTABLE} -m coverage run -a --branch ${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES} + ${PYTHON_EXECUTABLE} -m coverage run --branch -p ${PADDLE_SOURCE_DIR}/tools/test_runner.py ${py_test_modules_MODULES} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) else() add_test(NAME ${TARGET_NAME} -- GitLab