Commit 2acf5da
fix(ci): install template nodes into root venv before pytest (#1843)
The cli-python job's "Test Python template project" step has been
failing on every main commit since #1820 ("feat(uv): per-node
managed Python venvs at build + runtime", commit 6ae0fa9) --
5+ merged commits all red, blocking the Trunk merge queue alongside
the ros2-bridge regression that #1839 just resolved.
Root cause
==========
#1820 changed `dora build --uv` to install each node package into
its own managed venv at `.dora/python-envs/<node>/` (good for
deterministic per-node deps + no cross-node contamination). But the
`dora new --lang python` templates generated test stubs at
`tests/test_<node>.py` do:
from <node>.main import main
The CI step pytest invocation is `uv run pytest` from the
test_python_project root, which resolves against the ambient venv
(VIRTUAL_ENV set by the earlier setup-python-uv step to the
repo-level .venv/). That venv has dora-rs + pyarrow + pytest + ruff
but no node packages -- those are in the per-node venvs. Pre-#1820,
`dora build` installed nodes into whatever venv was active, so the
imports worked.
Actual failure from CircleCI v1.1 API log on main HEAD (job 5882,
step "Test Python template project"):
FAILED listener-1/tests/test_listener_1.py::test_import_main
> from listener_1.main import main
E ModuleNotFoundError: No module named 'listener_1'
FAILED talker-1/tests/test_talker_1.py::test_import_main
> from talker_1.main import main
E ModuleNotFoundError: No module named 'talker_1'
FAILED talker-2/tests/test_talker_2.py::test_import_main
> from talker_2.main import main
E ModuleNotFoundError: No module named 'talker_2'
3 failed, 3 passed
Fix
===
After `dora build --uv` (which sets up the per-node venvs), also
install the three node packages into the active venv so `uv run
pytest` at the project root can resolve their imports:
uv pip install -e listener-1 -e talker-1 -e talker-2
This preserves the per-node-venv isolation that #1820 introduced
(those venvs still drive `dora build` and `dora run`) while giving
the test pass a venv that sees all node packages. The root venv is
ephemeral and only used by this CI step, so no production
contamination.
Scope notes
===========
* CI-only fix; the `dora new` template itself is unchanged. Users
running `pytest` in their own `dora new` projects will hit the
same issue, but fixing that requires a template-level change
(e.g. root pyproject.toml that path-depends on each node, or a
documented "for testing, also pip install -e <node>/" step in
the README). That is a separate follow-up; this PR keeps scope
to "unblock the merge queue."
* The hardcoded node names listener-1, talker-1, talker-2 match
the `dora new --lang python` template (see
binaries/cli/src/template/python/mod.rs:126-130). If that
template grows or shrinks the node set, this list needs to
follow. A loop over `*/pyproject.toml` would be more robust but
also more clever-shell; keeping the explicit list for clarity.
Validation
==========
Local repro is awkward (the CI step builds the whole dora CLI from
source first), but the failure mode is mechanically obvious from
the log and the fix is a one-line `uv pip install -e` of the same
packages the build step references. CircleCI will validate on this
PR.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 210bb39 commit 2acf5da
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
626 | 637 | | |
627 | 638 | | |
628 | 639 | | |
| |||
0 commit comments