Skip to content

Commit

Permalink
Add NOCAPTURE option to ament_add_pytest_test
Browse files Browse the repository at this point in the history
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 <jacob@openrobotics.org>
  • Loading branch information
jacobperron committed Jul 18, 2022
1 parent 966930a commit f37d194
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ament_cmake_pytest/cmake/ament_add_pytest_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# :param path: the path to a file or folder where ``pytest`` should be invoked
# on
# :type path: string
# :param NOCAPTURE: disable pytest output capturing.
# Sets the pytest option '-s'.
# :type NOCAPTURE: option
# :param SKIP_TEST: if set mark the test as being skipped
# :type SKIP_TEST: option
# :param PYTHON_EXECUTABLE: Python executable used to run the test.
Expand Down Expand Up @@ -48,7 +51,7 @@
#
function(ament_add_pytest_test testname path)
cmake_parse_arguments(ARG
"SKIP_TEST"
"NOCAPTURE;SKIP_TEST"
"PYTHON_EXECUTABLE;RUNNER;TIMEOUT;WERROR;WORKING_DIRECTORY"
"APPEND_ENV;APPEND_LIBRARY_DIRS;ENV"
${ARGN})
Expand Down Expand Up @@ -96,6 +99,11 @@ function(ament_add_pytest_test testname path)
"--junit-prefix=${PROJECT_NAME}"
)

if(ARG_NOCAPTURE)
# disable output capturing
list(APPEND cmd "-s")
endif()

if(ARG_WERROR)
# treat warnings as errors
list(APPEND cmd "-We")
Expand Down

0 comments on commit f37d194

Please sign in to comment.