Repository navigation
ci: run the Python binding tests - #39
Merged
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI ran no Python tests at all, so
rustez-py/tests/*.pyhad never gated anything.Why this matters
That was not theoretical.
Device.touched_candidate()shipped in 0.14.0 (#38) present on the nativePyDevicebut missing from the hand-writtenrustez.Devicewrapper, so the advertised API raisedAttributeErrorfor 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-bindingsjob:setup-python3.12 (matching the interpreter the manylinux/musllinux wheels are built for inpublish-pypi.yml), then venv →maturin develop→pytest.maturin developrather than installing a built wheel, deliberately. It drops the compiled extension intopython/rustez/and installs a.pthpointing there, which is what the existingpythonpath = ["python"]pytest setting expects. Installing a wheel instead would put a second copy of the package onsys.path; the source tree would win and then fail to findrustez._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:
And confirmed the guard actually guards. A passing test proves nothing by itself, so I temporarily removed
Device.touched_candidateto recreate the shipped defect:Then restored it, with
git statusclean confirming the restore was byte-exact.Also verified
actions/setup-python@v6exists 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