Skip to content

Commit 1d890ff

Browse files
Add colcon test verb (#19)
* Add simple test implementation Signed-off-by: Luca Della Vedova <[email protected]> * Remove overload Signed-off-by: Luca Della Vedova <[email protected]> * Add noop arguments Signed-off-by: Luca Della Vedova <[email protected]> * Override installation to noop Signed-off-by: Luca Della Vedova <[email protected]> * Format Signed-off-by: Luca Della Vedova <[email protected]> * Remove additional targets Signed-off-by: Luca Della Vedova <[email protected]> --------- Signed-off-by: Luca Della Vedova <[email protected]>
1 parent 6ab718b commit 1d890ff

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

colcon_ros_cargo/task/ament_cargo/build.py

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ def _build_cmd(self, cargo_args):
8989
'--quiet'
9090
] + cargo_args
9191

92+
# Installation is done by cargo ament-build
93+
def _install_cmd(self, cargo_args): # noqa: D102
94+
pass
95+
9296

9397
def write_cargo_config_toml(package_paths):
9498
"""Write the resolved package paths to config.toml.
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Licensed under the Apache License, Version 2.0
2+
3+
from colcon_cargo.task.cargo.test import CargoTestTask
4+
from colcon_core.plugin_system import satisfies_version
5+
from colcon_core.task import TaskExtensionPoint
6+
7+
8+
class AmentCargoTestTask(CargoTestTask):
9+
"""A test task for packages with Cargo.toml + package.xml.
10+
11+
Tests are already built by `colcon build` so this task only needs to
12+
run them and doesn't need to worry about dependency management
13+
(unlike the `AmentCargoBuildTask`).
14+
"""
15+
16+
def __init__(self): # noqa: D107
17+
super().__init__()
18+
satisfies_version(TaskExtensionPoint.EXTENSION_POINT_VERSION, '^1.0')
19+
20+
def add_arguments(self, *, parser): # noqa: D102
21+
pass

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ colcon_core.package_identification =
7272
ament_cargo = colcon_ros_cargo.package_identification.ament_cargo:AmentCargoPackageIdentification
7373
colcon_core.task.build =
7474
ament_cargo = colcon_ros_cargo.task.ament_cargo.build:AmentCargoBuildTask
75+
colcon_core.task.test =
76+
ament_cargo = colcon_ros_cargo.task.ament_cargo.test:AmentCargoTestTask
7577

7678
[flake8]
7779
import-order-style = google

0 commit comments

Comments
 (0)