From ec0e7ff22e0bb1079bba296f01b071b07cdf6ff4 Mon Sep 17 00:00:00 2001 From: Karl W Schulz Date: Tue, 27 Feb 2024 13:46:33 -0600 Subject: [PATCH] add PYTEST_NUMPROCS option to define number of CPU threads for pytest where appropriate; defaults to a value of 1 but can be overwridden for CI purposed Signed-off-by: Karl W Schulz --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4a076a005..daab4ea587 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,6 +179,12 @@ if(${ENABLE_COVERAGE}) endif() message(STATUS "Code coverage: ${ENABLE_COVERAGE}") +# CPU threads available for testing +set(PYTEST_NUMPROCS + "1" + CACHE STRING "Number of parallel threads to use with CPU-oriented tests") +message(STATUS "Pytest CPU threadcount: ${PYTEST_NUMPROCS}") + # --------------------------- # profile mode tests # --------------------------- @@ -339,7 +345,8 @@ set_tests_properties( add_test( NAME test_analyze_workloads - COMMAND pytest ${COV_OPTION} ${PROJECT_SOURCE_DIR}/tests/test_analyze_workloads.py + COMMAND pytest -n ${PYTEST_NUMPROCS} --junitxml=tests/test_analyze_workloads.xml + ${COV_OPTION} ${PROJECT_SOURCE_DIR}/tests/test_analyze_workloads.py WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) # ---------------------------