Repository navigation
Conversation
… failure
A `.py`-only root selection was planned as `python3 -m pytest {files}`
without asking whether python3 can import pytest. On a machine without it
the lane exited 1 with "No module named pytest" and was reported as
PREGATE_LANE_FAILED, "fix the in-branch failure". The run-time classifier
cannot catch it: the command's binary, python3, is on PATH.
planRuns now checks before the run, as it already does for pnpm/yarn, cargo
and dart/flutter: python3 off PATH names python3, a python3 that cannot find
the pytest module names pytest. The file is unclaimed and the lane is
PREGATE_ENVIRONMENT (missing-binary), "install pytest on this machine and
rerun, or run the lane remotely; the diff is not at fault".
Fixes garrytan#3598
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Contributor
|
Thank you for this fix. A crew lane is picking it up, together with your two related pregate PRs, to land on current main with Co-authored-by credit to you. |
4 tasks done
Contributor
|
Thanks @vilano93. This landed in v1.93.15.0 as #3741: a missing pytest is now PREGATE_ENVIRONMENT, not a failure of the diff. The fix was rewritten on current main rather than merged from this branch (our policy for outside code), and the idea is credited in the changelog. Closing this PR in favor of that change. |
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.
Why (in your own words)
On a machine without pytest,
lanesblames the diff. A.py-only root selection is planned aspython3 -m pytest {files}with no check that python3 can import pytest. The run exits 1 withNo module named pytest, and the lane reportsPREGATE_LANE_FAILEDwith "fix the in-branch failure", even when the test itself is green. The run-time classifier can't catch this, because the command's binary,python3, is on PATH.This change checks before the run, the same way
planRunsalready does for pnpm/yarn, cargo and dart/flutter. If python3 is off PATH, the missing tool ispython3. If python3 can't find the pytest module, the missing tool ispytest. Either way the file stays unclaimed, and the lane isPREGATE_ENVIRONMENT(missing-binary): "install pytest on this machine and rerun, or run the lane remotely; the diff is not at fault". The probe asks the python3 the runner will use (importlib.util.find_spec("pytest")) instead of looking for apytestscript on PATH, because a script installed with pipx can belong to a different interpreter.Fixes #3598
Live evidence
The repro from #3598: a repo with one
unittest-style test,tests/test_alpha.py, touched on a branch.python3 -m unittestpasses it, and this machine has no pytest.The new tests were red first, then green:
Scope
lib/pregate/checks/lanes.ts: a newpytestMissing(env). It resolvespython3on the runner's PATH and runs afind_spec("pytest")probe with a 10 s timeout.planRunscalls it only when the detected root runner is the pytest one. A declaredrunnernever reaches it, becauseplanRunsreturns before this code.test/pregate-environment.test.ts: a plan-level case covering pytest importable, not importable, and no python3 (with apython3shim and an empty PATH), plus an end-to-end case showingPREGATE_ENVIRONMENTand that the lane never starts.bun run typecheck: clean;bun run typecheck:test: "814 known diagnostics, none new".upstream/mainworktree (81a8272) on macOS:pregate-manifest-paths,pregate-removed-paths,pregate-selection,pregate-non-js): 88 pass and 9 fail on both, with the same names. These are the macOS-host failures noted in fix(pregate): Rust crate lanes and nested JS package runners (#3344) #3346.bun run teston this branch reports failing tests in 62 files. None of them is in pregate lane planning: they are this Mac's host failures (browser settlement, gbrain, cso, qa and others). I ran those 62 files (1,975 tests) on both trees. Main fails 386 and this branch fails 385. No test fails only on this branch. The one extra failure on main istest-free-shards … settlement … timeout, which is flaky.py/pythonrather thanpython3. That is unchanged: the runner was alreadypython3, and the probe follows it.pytestmissing. I don't know of a case where that happens.not on PATH: pytest, which is loose wording for a missing module. I keptplanGap's wording unchanged, because the dart/cargo/pnpm tests pin it.restblock inplanRuns. Whichever lands second needs a small rebase: with fix(pregate): root tests in two languages each get their own runner #3600, the check goes inside its per-language loop.Liveness proof (required for external contributors)
Checklist
GSTACK PRtyped live into a real surface) or PR author is @garrytan (owner exemption)🤖 Generated with Claude Code