-
Notifications
You must be signed in to change notification settings - Fork 0
Expose uv's libpython on LD_LIBRARY_PATH for PyO3 baselines (#372) #379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,38 @@ def _step_names(steps: list[dict[str, object]]) -> list[object]: | |
| return [step.get("name") for step in steps] | ||
|
|
||
|
|
||
| def test_mutants_job_exposes_libpython_before_running() -> None: | ||
| """The mutants job puts libpython on LD_LIBRARY_PATH before cargo-mutants. | ||
|
|
||
| PyO3 embedding crates link their test binaries against the uv-managed | ||
| interpreter that "Setup uv" places on PATH, whose libpython is not on the | ||
| loader's default search path. Without exporting its LIBDIR onto | ||
| LD_LIBRARY_PATH the baseline `cargo test` binary aborts at run time and no | ||
| mutant is scored (issue #372). The export must land before the | ||
| "Run mutation testing" step that builds and runs those binaries. | ||
| """ | ||
| jobs = _jobs("mutation-cargo.yml") | ||
| assert "mutants" in jobs, "mutation-cargo.yml must declare a mutants job" | ||
| steps = _steps(jobs["mutants"]) | ||
| names = _step_names(steps) | ||
| exposers = [ | ||
| index | ||
| for index, step in enumerate(steps) | ||
| if isinstance(step.get("run"), str) | ||
| and "LD_LIBRARY_PATH=" in typ.cast("str", step.get("run")) | ||
| and 'get_config_var("LIBDIR")' in typ.cast("str", step.get("run")) | ||
| ] | ||
|
Comment on lines
+72
to
+78
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Assert persistence through Require the shape test to verify that the export script writes to and "LD_LIBRARY_PATH=" in typ.cast("str", step.get("run"))
and 'get_config_var("LIBDIR")' in typ.cast("str", step.get("run"))
+ and "GITHUB_ENV" in typ.cast("str", step.get("run"))
+ and ">>" in typ.cast("str", step.get("run"))🤖 Prompt for AI Agents |
||
| assert exposers, ( | ||
| "mutation-cargo.yml mutants job must export the interpreter LIBDIR " | ||
| "onto LD_LIBRARY_PATH for PyO3 test binaries (issue #372)" | ||
| ) | ||
| assert "Run mutation testing" in names, "mutants job must run cargo-mutants" | ||
| run_index = names.index("Run mutation testing") | ||
| assert min(exposers) < run_index, ( | ||
| "the LD_LIBRARY_PATH export must precede the Run mutation testing step" | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("workflow_name", WORKFLOW_NAMES) | ||
| def test_every_workflow_checkout_is_followed_by_relocation( | ||
| workflow_name: str, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Qualify the automatic-handling claim.
State that this applies when the workflow resolves a valid
LIBDIRon hosted runners. The implementation skips the export underACT=trueand intentionally continues unchanged whenLIBDIRis missing, so “Nosetup-commandsworkaround is needed” is not universally guaranteed.🤖 Prompt for AI Agents