Skip to content

ci: run the Python binding tests - #39

Merged
fastrevmd-lab merged 1 commit into
mainfrom
ci/python-binding-tests
Aug 20, 2026
Merged

fastrevmd-lab merged 1 commit into
mainfrom
ci/python-binding-tests

Conversation

@fastrevmd-lab

Copy link
Copy Markdown
Member

CI ran no Python tests at all, so rustez-py/tests/*.py had never gated anything.

Why this matters

That was not theoretical. Device.touched_candidate() shipped in 0.14.0 (#38) present on the native PyDevice but missing from the hand-written rustez.Device wrapper, so the advertised API raised AttributeError for every caller. It was caught in review, not by CI — and no Rust job could have caught it, because the wrapper is pure Python and forwards each method explicitly with no __getattr__ delegation.

What this adds

A python-bindings job: setup-python 3.12 (matching the interpreter the manylinux/musllinux wheels are built for in publish-pypi.yml), then venv → maturin develop → pytest.

maturin develop rather than installing a built wheel, deliberately. It drops the compiled extension into python/rustez/ and installs a .pth pointing there, which is what the existing pythonpath = ["python"] pytest setting expects. Installing a wheel instead would put a second copy of the package on sys.path; the source tree would win and then fail to find rustez._rustez_native. The reasoning is in a comment in the workflow so the next person does not "simplify" it into a breakage.

Verification

Rather than trusting the recipe, I ran it verbatim — fresh 3.12 venv, same four commands:

📦 Built wheel for CPython 3.12
🛠 Installed rustez-0.14.0
....................  [100%]
20 passed in 0.03s

And confirmed the guard actually guards. A passing test proves nothing by itself, so I temporarily removed Device.touched_candidate to recreate the shipped defect:

>       assert hasattr(Device, "touched_candidate")
E       AssertionError: assert False
FAILED tests/test_candidate_tracking.py::test_device_wrapper_exposes_touched_candidate
1 failed, 19 passed

Then restored it, with git status clean confirming the restore was byte-exact.

Also verified actions/setup-python@v6 exists rather than guessing the tag, and gitignored the .venv/ the job creates.

Scope note

This closes the gap going forward. The 0.14.0 wheels already on PyPI were published before any of this ran — they are fine, since the suite now confirms the code in them is correct, but that confirmation came after the upload rather than before.

🤖 Generated with Claude Code

`ci.yml` ran no Python tests at all, so `rustez-py/tests/*.py` had never gated
anything. That was not theoretical: `Device.touched_candidate()` shipped in
0.14.0 present on the native `PyDevice` but missing from the hand-written
`rustez.Device` wrapper, so the advertised API raised `AttributeError` for
every caller. No Rust job could have caught it — the wrapper is pure Python and
forwards each method explicitly, with no `__getattr__` delegation.

Adds a `python-bindings` job: setup-python 3.12 (matching the interpreter the
musllinux/manylinux wheels are built for), then venv -> maturin develop ->
pytest.

`maturin develop` rather than installing a built wheel, deliberately. It drops
the compiled extension into `python/rustez/` and installs a `.pth` pointing
there, which is what the existing `pythonpath = ["python"]` pytest setting
expects. Installing a wheel instead would put a second copy of the package on
sys.path; the source tree would win and then fail to find
`rustez._rustez_native`. The reasoning is recorded in a comment so the next
person does not "simplify" it into a breakage.

Verified by running the recipe verbatim rather than trusting it: a fresh 3.12
venv, `maturin develop`, `pytest -q` -> 20 passed. The four
`test_candidate_tracking.py` cases were also confirmed to FAIL when
`Device.touched_candidate` is removed, so the guard actually guards rather than
passing vacuously.

Also gitignores `.venv/`, which the job creates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fastrevmd-lab
fastrevmd-lab merged commit 82c7ae0 into main Aug 20, 2026
4 checks passed
@fastrevmd-lab
fastrevmd-lab deleted the ci/python-binding-tests branch August 20, 2026 02:06
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