From dfd51d45836105906fad1a44c2afd6cd41b1e4a1 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 21 Jun 2024 11:16:03 -0500 Subject: [PATCH] Don't write Python bytecode when invoking pytest (#533) This should prevent pytest invocations via ament_add_pytest_test from writing __pycache__ directories into the package sources. Signed-off-by: Scott K Logan --- ament_cmake_pytest/cmake/ament_add_pytest_test.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ament_cmake_pytest/cmake/ament_add_pytest_test.cmake b/ament_cmake_pytest/cmake/ament_add_pytest_test.cmake index 7afe858a..06abfbd1 100644 --- a/ament_cmake_pytest/cmake/ament_add_pytest_test.cmake +++ b/ament_cmake_pytest/cmake/ament_add_pytest_test.cmake @@ -99,6 +99,8 @@ function(ament_add_pytest_test testname path) "--junit-prefix=${PROJECT_NAME}" ) + set(ARG_ENV PYTHONDONTWRITEBYTECODE=1 ${ARG_ENV}) + if(ARG_NOCAPTURE) # disable output capturing list(APPEND cmd "-s")