Open sea-bass opened 1 year ago
This may also be an issue with the ament_add_pytest_test
function here: https://github.com/ament/ament_cmake/blob/rolling/ament_cmake_pytest/cmake/ament_add_pytest_test.cmake
Any news on this? I've noticed the same when trying to select a single test to run with colcon test --pytest args -k <test_name>
@sea-bass is absolutely correct here. When ament_cmake
wraps pytest, it doesn't give colcon (or anything else) a way to pass arbitrary arguments to the wrapped pytest invocation. The --pytest-args
argument to colcon is intended for use in a python
or ament_python
package, not a cmake
or ament_cmake
package.
All that said, if ament_cmake_pytest
were to expose a mechanism for passing these arbitrary arguments through to the invoked process, we could do some wiring between colcon-cmake
and colcon-ros
to pass through --pytest-args
if specified. One major challenge here is that ament_cmake_pytest
embeds the pytest command to a ctest file at build time, and --pytest-args
is an argument to colcon's test
verb, so we can't just introduce an extra CMake argument to ament_add_pytest_test.cmake
, it would likely have to be an environment variable.
In any case, I'm going to move this ticket to colcon-ros
. There isn't anything that can be done in colcon until ament_cmake
provides a mechanism to achieve the desired behavior.
I'm running some tests with
colcon test --pytest-with-coverage
on rolling.This automatically enables the options
--cov-report html:<some path>
and--cov-report xml:<some path>
.However, there is also a
--cov-report term
option that should display test results to console, which I want to add manually using the--pytest-args
option.If I do the following, the results are still not displayed:
The equivalent command that is run, per the console logs, is:
As you see, the
--cov-report term
text is nowhere to be found in the above snippet.I then realized if I add any arguments, like
--pytest-args " --hello"
, not even that gets reflected.Am I missing something, or does the
--pytest-args
option not currently work?