Skip to content

feat: add ltest verb and CI-friendly output - #5

Merged
RyodoTanaka merged 3 commits into
masterfrom
feat/ltest-and-ci-mode
Oct 9, 2026
Merged

RyodoTanaka merged 3 commits into
masterfrom
feat/ltest-and-ci-mode

Conversation

@RyodoTanaka

Copy link
Copy Markdown
Member

Summary

  • New verb colcon ltest (alias colcon lt): colcon test with the same live per-package board as lbuild, a readable JUnit-based summary (tests/failures/errors/skipped per package, failing test cases with messages, JUnit locations), a non-zero exit on any failure, and an isolated ROS_DOMAIN_ID per run.
  • ltest options: --isolated-domain (default on; --no-isolated-domain), --no-user-site, --fail-on-skip PATTERN, --retest-failed, --ci. All colcon test arguments still work.
  • CI mode for lbuild and ltest: used when stdout is not a TTY, with --ci, or when CI/GITHUB_ACTIONS is set. Prints a stable per-package log; on GitHub Actions uses ::group::, ::error annotations, and writes a Markdown summary to $GITHUB_STEP_SUMMARY.
  • Terminal behavior of lbuild and lclean is unchanged.
  • Unregistered CI handlers fall back to the live board, so a shadowing install can no longer produce a KeyError from --event-handlers.
  • Version 0.2.0 (CHANGELOG updated), README sections for lt and CI mode with a GitHub Actions example.

Design decisions

  • Isolated domain on by default. On a LAN with live robot nodes, a test on the default domain can reach them. Free domain plus loopback discovery keeps test traffic inside the test run. Use --no-isolated-domain if a test must reach other machines.
  • --no-user-site scope. It sets PYTHONNOUSERSITE=1 for the whole test run, so every Python child process is affected, not only pytest. Narrowing it to pytest alone is not possible through colcon. Documented in README.
  • Parallelism. ltest keeps colcon test's default parallelism (not lbuild's unlimited).

Testing

  • pytest test/: 39 tests covering the JUnit summary, CI detection, workflow command escaping, step summary, fail-on-skip, domain isolation, the CI log handler, and the ltest verb. Added as a step in ci.yml.
  • flake8 (CI configuration) passes.
  • python -m build and twine check dist/* pass.
  • Real workspace (ce-curve, oedo_config_paths): colcon lb and colcon lt both finish with exit 0, in terminal (pty) and with CI=1.
  • Real workspace (ce-curve, oedo_response_curve): colcon lt ran 147 tests (18 skipped), all passed, JUnit summary printed.

🤖 Generated with Claude Code

RyodoTanaka and others added 3 commits October 9, 2026 08:44
Add `colcon ltest` (alias `lt`): colcon test with the live per-package
board, a readable summary built from JUnit (tests/failures/errors/skipped,
failing test cases with messages, JUnit locations), a non-zero exit on any
failure, an isolated ROS_DOMAIN_ID per run (on by default), and options
--no-isolated-domain, --no-user-site, --fail-on-skip PATTERN,
--retest-failed.

Add CI mode to lbuild and ltest: used when stdout is not a TTY, with --ci,
or when CI/GITHUB_ACTIONS is set. It prints a stable per-package log, GitHub
Actions groups and ::error annotations, and writes a Markdown summary to
$GITHUB_STEP_SUMMARY. Terminal output of lbuild/lclean is unchanged.

Unregistered CI handlers fall back to the live board, so a shadowing
installation can no longer make --event-handlers fail with a KeyError.

Add pytest tests under test/ and run them in CI. Bump to 0.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- CI mode is driven only by --ci and CI/GITHUB_ACTIONS. A non-TTY stdout
  no longer switches lbuild/ltest to the CI log, so piped `colcon lb`
  output matches 0.1.1 (pinned by a test and checked against 0.1.1).
- ltest: a run with zero test cases warns; in CI mode it exits non-zero
  unless --allow-no-tests is given. Selected packages without results are
  reported.
- --isolated-domain picks from 1..101 (not 0, and not above 101 where the
  DDS ports reach the Linux ephemeral range) and skips the current
  ROS_DOMAIN_ID.
- New event handler entry points are prefixed live_tools_ (live_status is
  kept): live_tools_test_status, live_tools_ci_status,
  live_tools_ci_test_status, live_tools_test_recorder.
- Test-run CI group titles say "done" or "FAIL" instead of "OK".
- test_ltest.py works when colcon-package-selection is installed.
- CHANGELOG and README updated to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…age-selection

Also document --allow-no-tests for workspaces whose tests write no JUnit XML.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RyodoTanaka
RyodoTanaka merged commit f9373e2 into master Oct 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant