Skip to content

ci: run the PyO3 crates' unit tests instead of only compiling their libs - #3124

Merged
trunk-io[bot] merged 1 commit into
mainfrom
ci-python-node-unit-tests
Aug 11, 2026
Merged

ci: run the PyO3 crates' unit tests instead of only compiling their libs#3124
trunk-io[bot] merged 1 commit into
mainfrom
ci-python-node-unit-tests

Conversation

@phil-opp

Copy link
Copy Markdown
Collaborator

The three PyO3 crates have 46 #[cfg(test)] unit tests between them that no CI
job has ever run. They're excluded from cargo test (ci.yml, nightly.yml)
and from clippy; the only job that touches them is cargo check --all, which
builds lib targets only. So the test modules weren't even type-checked — a
syntax error inside one could ship, and any regression test added there carries
no enforcement (noticed while reviewing #3039, which adds four).

Two gates now cover them:

  • check (every PR) adds cargo check --all-targets for the three crates.
    rmeta-only against a dependency graph the previous step already checked with
    the same features, so it costs seconds. Verified it catches the gap: a
    deliberate type error inside seqlock_tests passes cargo check --all and
    fails this step.
  • contract-tests (merge gate) runs the new make qa-test-python. That job is
    the one with actions/setup-python, which these test binaries need: cargo
    builds the crates without pyo3/extension-module, so unlike the maturin
    wheel they link libpython directly. It runs before the wheel build — the two
    feature sets can't share pyo3 artifacts anyway, so a failing unit test
    surfaces without waiting on maturin.

make qa-test-python stays out of qa-test: folding it in would break the
everyday local gate on a machine without a shared libpython ≥ 3.11.

All 46 pass today (33 dora-node-api-python, 7 dora-operator-api-python, 6
dora-ros2-bridge-python), so this only locks in current behavior.

Linux-only, matching the rest of PR CI. Extending it to nightly's macOS and
Windows legs would mean a cold pyo3 build on each, which isn't worth the ~3-4h
budget there.

`dora-node-api-python`, `dora-operator-api-python` and
`dora-ros2-bridge-python` are excluded from `cargo test` (ci.yml, nightly.yml)
and from clippy. The only job that touched them was `cargo check --all`, which
builds lib targets only — so their 46 `#[cfg(test)]` unit tests (seqlock
generation counters, transport classification, pinning thresholds, DORADMA
read-after-free tracking) were never compiled, let alone run, and a syntax
error inside one of those modules could ship.

Two gates now cover them:

- `check` (every PR) adds `cargo check --all-targets` for the three crates.
  rmeta-only on an already-checked dependency graph, so it costs seconds and
  catches test modules that no longer compile.
- `contract-tests` (merge gate) runs `make qa-test-python`. It is the one job
  that sets up a Python interpreter, which these test binaries need: cargo
  builds the crates without `pyo3/extension-module`, so unlike the maturin
  wheel they link libpython directly. The step runs before the wheel build,
  since the two feature sets cannot share pyo3 artifacts anyway.

`make qa-test-python` stays out of `qa-test` on purpose — it would make the
everyday local gate fail on a machine without a shared libpython >= 3.11.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

👍 Pull request will be merged soon because tests have passed on #2859, which was a pull request behind this one (test branch SHA) - details.

@trunk-io
trunk-io Bot merged commit 20d988f into main Aug 11, 2026
16 checks passed
@trunk-io
trunk-io Bot deleted the ci-python-node-unit-tests branch August 11, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant