Skip to content

Commit 65a3ad5

Browse files
authored
Add NOCAPTURE option to ament_add_pytest_test (#393)
This lets the user pass the '-s' option to pytest so we can see all test process output in the console. Signed-off-by: Jacob Perron <[email protected]>
1 parent 966930a commit 65a3ad5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ament_cmake_pytest/cmake/ament_add_pytest_test.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
# :param path: the path to a file or folder where ``pytest`` should be invoked
2121
# on
2222
# :type path: string
23+
# :param NOCAPTURE: disable pytest output capturing.
24+
# Sets the pytest option '-s'.
25+
# :type NOCAPTURE: option
2326
# :param SKIP_TEST: if set mark the test as being skipped
2427
# :type SKIP_TEST: option
2528
# :param PYTHON_EXECUTABLE: Python executable used to run the test.
@@ -48,7 +51,7 @@
4851
#
4952
function(ament_add_pytest_test testname path)
5053
cmake_parse_arguments(ARG
51-
"SKIP_TEST"
54+
"NOCAPTURE;SKIP_TEST"
5255
"PYTHON_EXECUTABLE;RUNNER;TIMEOUT;WERROR;WORKING_DIRECTORY"
5356
"APPEND_ENV;APPEND_LIBRARY_DIRS;ENV"
5457
${ARGN})
@@ -96,6 +99,11 @@ function(ament_add_pytest_test testname path)
9699
"--junit-prefix=${PROJECT_NAME}"
97100
)
98101

102+
if(ARG_NOCAPTURE)
103+
# disable output capturing
104+
list(APPEND cmd "-s")
105+
endif()
106+
99107
if(ARG_WERROR)
100108
# treat warnings as errors
101109
list(APPEND cmd "-We")

0 commit comments

Comments
 (0)