# colcon test: Failed to find test dependencies: 'python3-pytest', 'ros_testing' not installed

- **ID:** `ros2/colcon-test-failure-test-dependencies-not-installed`
- **Domain:** ros2
- **Category:** test_error
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

colcon test requires test dependencies specified in package.xml (under <test_depend>) to be installed in the workspace. Missing system or ROS packages cause test execution to fail.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Humble | active | — | — |
| Iron | active | — | — |
| Rolling | active | — | — |

## Workarounds

1. **Install test dependencies explicitly: rosdep install --from-paths src --ignore-src -r -y --rosdistro humble --include-test-dependencies. Then run colcon test again.** (90% success)
   ```
   Install test dependencies explicitly: rosdep install --from-paths src --ignore-src -r -y --rosdistro humble --include-test-dependencies. Then run colcon test again.
   ```
2. **For missing system packages like python3-pytest, install manually: sudo apt-get install python3-pytest. For ROS packages like ros_testing: sudo apt-get install ros-humble-ros-testing.** (85% success)
   ```
   For missing system packages like python3-pytest, install manually: sudo apt-get install python3-pytest. For ROS packages like ros_testing: sudo apt-get install ros-humble-ros-testing.
   ```
3. **If test dependencies are optional, temporarily remove them from package.xml and run colcon test with --packages-skip-build-failed to skip problematic packages.** (70% success)
   ```
   If test dependencies are optional, temporarily remove them from package.xml and run colcon test with --packages-skip-build-failed to skip problematic packages.
   ```

## Dead Ends

- **** — The error will still occur for the selected package if dependencies are missing. The --packages-select flag doesn't bypass dependency resolution. (95% fail)
- **** — This command by default skips test dependencies unless --rosdistro and --include-test-dependencies are specified. (85% fail)
