Skip to content

The --pytest-args option in colcon test does not affect the commands executed #151

Description

@sea-bass

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:

colcon test --event-handlers console_direct+ --pytest-with-coverage --pytest-args " --cov-report term"

The equivalent command that is run, per the console logs, is:

1: -- run_test.py: invoking following command in '/home/sebastian/pyrobosim_ws/src/pyrobosim/pyrobosim_ros':
1:  - /home/sebastian/python-virtualenvs/pyrobosim/bin/python3.10 -u -m pytest
 /home/sebastian/pyrobosim_ws/src/pyrobosim/pyrobosim_ros/test/test_ros_conversions.py 
-o cache_dir=/home/sebastian/pyrobosim_ws/build/pyrobosim_ros/test/ament_cmake_pytest/test_ros_conversions/.cache 
--junit-xml=/home/sebastian/pyrobosim_ws/build/pyrobosim_ros/test_results/pyrobosim_ros/test_ros_conversions.xunit.xml 
--junit-prefix=pyrobosim_ros --cov=/home/sebastian/pyrobosim_ws/src/pyrobosim/pyrobosim_ros/test 
--cov-report=html:/home/sebastian/pyrobosim_ws/build/pyrobosim_ros/test/pytest_cov/test_ros_conversions/coverage.html 
--cov-report=xml:/home/sebastian/pyrobosim_ws/build/pyrobosim_ros/test/pytest_cov/test_ros_conversions/coverage.xml 
--cov-branch

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions