Quantcast
Viewing latest article 3
Browse Latest Browse All 4

Comment by lmiller for Hi all,I am writing some tests for my ROS2 Python package. I want to specify different levels of tests (unittest, integrationtests, system tests, ...) and run them with colcon test . I have the different tests in subfolders in the test directory:my_pkg ├── launch │   └── example.launch.py ├── my_pkg │   ├── __init__.py │   ├── my_node.py │   ├── publisher.py │   ├── subscriber.py │   └── transformer.py ├── package.xml ├── README.md ├── resource │   └── my_pkg ├── setup.cfg ├── setup.py └── test ├── integrationtest │   └── test_integration.py └── unittest ├── test_pytest.py └── test_unittest.py Colcon detects all tests, what is great. But sometimes I only want run e.g. the tests in the directory unittests. That woult be useful, because some of my integration or system tests needs a long time!Are there any possibilities to run a specific subfolder of the test directory with colcon test? Have colcon some command line arguments for this? Or is there another way to go?

Previous: Comment by shonigmann for Hi all,I am writing some tests for my ROS2 Python package. I want to specify different levels of tests (unittest, integrationtests, system tests, ...) and run them with colcon test . I have the different tests in subfolders in the test directory:my_pkg ├── launch │   └── example.launch.py ├── my_pkg │   ├── __init__.py │   ├── my_node.py │   ├── publisher.py │   ├── subscriber.py │   └── transformer.py ├── package.xml ├── README.md ├── resource │   └── my_pkg ├── setup.cfg ├── setup.py └── test ├── integrationtest │   └── test_integration.py └── unittest ├── test_pytest.py └── test_unittest.py Colcon detects all tests, what is great. But sometimes I only want run e.g. the tests in the directory unittests. That woult be useful, because some of my integration or system tests needs a long time!Are there any possibilities to run a specific subfolder of the test directory with colcon test? Have colcon some command line arguments for this? Or is there another way to go?
Thanks for your reply. My first thought was also that I could call up the various tests via side-/sub-packages. However, I dont like the structure of my repository with too many sub-packages. As a current workaround I call `pytest` instead of `colcon test` like: python3 -m pytest my_pkg/test/integrationtest If someone has another way to call the tests only from a subfolder please let me know!

Viewing latest article 3
Browse Latest Browse All 4

Trending Articles