Skip to content

Commit

Permalink
Add WERROR option to ament_add_pytest_test (#168)
Browse files Browse the repository at this point in the history
This has the benefit of making deprecation warnings visible, which are not by default.
Default value for the option is OFF.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
  • Loading branch information
jacobperron committed Jun 3, 2019
1 parent ba77330 commit 3c432f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ament_cmake_pytest/cmake/ament_add_pytest_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
# :param TIMEOUT: the test timeout in seconds,
# default defined by ``ament_add_test()``
# :type TIMEOUT: integer
# :param WERROR: If ON, then treat warnings as errors. Default: OFF.
# :type WERROR: bool
# :param WORKING_DIRECTORY: the working directory for invoking the
# command in, default defined by ``ament_add_test()``
# :type WORKING_DIRECTORY: string
Expand All @@ -45,7 +47,7 @@
function(ament_add_pytest_test testname path)
cmake_parse_arguments(ARG
"SKIP_TEST"
"PYTHON_EXECUTABLE;TIMEOUT;WORKING_DIRECTORY"
"PYTHON_EXECUTABLE;TIMEOUT;WERROR;WORKING_DIRECTORY"
"APPEND_ENV;APPEND_LIBRARY_DIRS;ENV"
${ARGN})
if(ARG_UNPARSED_ARGUMENTS)
Expand Down Expand Up @@ -89,6 +91,11 @@ function(ament_add_pytest_test testname path)
"--junit-prefix=${PROJECT_NAME}"
)

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

if(ARG_ENV)
set(ARG_ENV "ENV" ${ARG_ENV})
endif()
Expand Down

0 comments on commit 3c432f2

Please sign in to comment.