mirror of https://github.com/lammps/lammps.git
Use .coveragerc to configure Python coverage reporting
This commit is contained in:
parent
43261c3a4f
commit
a26da031aa
|
@ -0,0 +1,10 @@
|
|||
[run]
|
||||
source = @LAMMPS_PYTHON_DIR@
|
||||
parallel=True
|
||||
branch=True
|
||||
omit=*/install.py
|
||||
*/setup.py
|
||||
|
||||
[paths]
|
||||
sources = python
|
||||
@LAMMPS_PYTHON_DIR@
|
|
@ -54,6 +54,8 @@ if(ENABLE_COVERAGE)
|
|||
|
||||
if(COVERAGE_FOUND)
|
||||
set(PYTHON_COVERAGE_HTML_DIR ${CMAKE_BINARY_DIR}/python_coverage_html)
|
||||
configure_file(.coveragerc.in ${CMAKE_BINARY_DIR}/.coveragerc @ONLY)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/unittest/python/.coverage
|
||||
COMMAND ${COVERAGE_BINARY} combine
|
||||
|
@ -63,16 +65,16 @@ if(ENABLE_COVERAGE)
|
|||
|
||||
add_custom_target(
|
||||
gen_python_coverage_html
|
||||
COMMAND ${COVERAGE_BINARY} html -d ${PYTHON_COVERAGE_HTML_DIR}
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage
|
||||
COMMAND ${COVERAGE_BINARY} html --rcfile=${CMAKE_BINARY_DIR}/.coveragerc -d ${PYTHON_COVERAGE_HTML_DIR}
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage ${CMAKE_BINARY_DIR}/.coveragerc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Generating HTML Python coverage report..."
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
gen_python_coverage_xml
|
||||
COMMAND ${COVERAGE_BINARY} xml -o ${CMAKE_BINARY_DIR}/python_coverage.xml
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage
|
||||
COMMAND ${COVERAGE_BINARY} xml --rcfile=${CMAKE_BINARY_DIR}/.coveragerc -o ${CMAKE_BINARY_DIR}/python_coverage.xml
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/unittest/python/.coverage ${CMAKE_BINARY_DIR}/.coveragerc
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/unittest/python
|
||||
COMMENT "Generating XML Python coverage report..."
|
||||
)
|
||||
|
|
|
@ -46,7 +46,7 @@ if(Python_EXECUTABLE)
|
|||
find_package_handle_standard_args(COVERAGE DEFAULT_MSG COVERAGE_BINARY)
|
||||
|
||||
if(COVERAGE_FOUND)
|
||||
set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE} -u ${COVERAGE_BINARY} run --parallel-mode --include=${LAMMPS_PYTHON_DIR}/lammps/*.py --omit=${LAMMPS_PYTHON_DIR}/install.py)
|
||||
set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE} -u ${COVERAGE_BINARY} run --rcfile=${CMAKE_BINARY_DIR}/.coveragerc)
|
||||
else()
|
||||
set(PYTHON_TEST_RUNNER ${Python_EXECUTABLE} -u)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue