From e19acf196c518fd7f8fe39a7f64f3febb35b6dfb Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 27 Aug 2023 12:49:14 +0200 Subject: test: add a target to generate an HTML report --- test/CMakeLists.txt | 11 ++++++++++- test/py/requirements.txt | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/py/requirements.txt (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fa34457..df8db29 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,7 +4,7 @@ find_package(Python3 REQUIRED COMPONENTS Interpreter) set(python_test_args --no-header -v - --durations=0 --durations-min=1.0 + --durations 0 --durations-min 1.0 "${CMAKE_CURRENT_SOURCE_DIR}/py" --server "$" --worker "$" @@ -23,6 +23,15 @@ endfunction() add_python_tests(python_tests_default Python3::Interpreter -m pytest ${python_test_args} -m "not flame_graph") +# Use pytest-html to generate an HTML report. +if(NOT DEFINED TEST_REPORT_DIR) + set(TEST_REPORT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +endif() + +add_python_tests(python_tests_report + Python3::Interpreter -m pytest ${python_test_args} -m "not flame_graph" + --html "${TEST_REPORT_DIR}/index.html") + # A subset of tests, excluding long-running stress tests. add_python_tests(python_tests_sanity Python3::Interpreter -m pytest ${python_test_args} -m "not flame_graph and not stress") diff --git a/test/py/requirements.txt b/test/py/requirements.txt new file mode 100644 index 0000000..43300f8 --- /dev/null +++ b/test/py/requirements.txt @@ -0,0 +1 @@ +pytest-html ~= 3.0 -- cgit v1.2.3