Conversation
The harness ran `python3` from `PATH` and ignored `environment.python_path`, then papered over the mismatch by injecting pact's site-packages. When `PATH` had no pytest, a passing suite parsed as 0 tests and 0 errors. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FeZUmAZbyQWDJNAPkUA3S
MrJoy
marked this pull request as ready for review
September 28, 2026 19:25
The contract-test harness runs pytest under pact's own interpreter, so a pipx or `uv tool` install without the `dev` extra couldn't run tests at all. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FeZUmAZbyQWDJNAPkUA3S
There was a problem hiding this comment.
Confidence Score: 0/5
Summary
Review of 35ed5b2 is stale because the PR advanced to 85cda5a. That commit addresses pytest packaging; rerun validation after fixing the remaining interpreter-configuration propagation issue.
Important Files Changed
| File | Overview |
|---|---|
| src/pact/config.py | Defaults execution environments to Pact’s interpreter |
| src/pact/test_harness.py | Interpreter selection changes without propagating configuration from production callers |
| tests/test_environment.py | Updates default-interpreter expectations |
| tests/test_test_harness.py | Adds interpreter, PYTHONPATH isolation, and missing-pytest tests |
None of the 11 `run_contract_tests` callers passed `environment`, so a `python_path` set in `pact.yaml` or the global config never reached the harness. They now pass the resolved `EnvironmentSpec`. An unconfigured project resolves to the same interpreter and env as before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MXo6tGa9GdEhd8bZuX6cuo
This branch has not been deployed
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.
run_contract_testsranpython3fromPATHand ignoredenvironment.python_path. When thatpython3has no pytest, a passing test file comes back astotal=0, errors=0, which looks like nothing went wrong. The same file, run on this machine wherePATHresolvespython3to pyenv's 3.9:Changes:
environment.python_pathwhen one is set, and undersys.executableotherwise.EnvironmentSpecandresolve_environmentnow default tosys.executabletoo.purelibis no longer added toPYTHONPATH. It came in with 29ed47d soanyiowould be importable from the wrong interpreter. Undersys.executableit's redundant. Under a custompython_pathit mixes two environments' site-packages, which is bad news for compiled packages likepydantic_core.No module named pytestnow comes back as anenvironmenterror naming the interpreter, instead of 0/0.pytestmoves from thedevextra to the runtime dependencies. The harness now runs pytest under pact's own interpreter, so a pipx oruv toolinstall with no extras needs it. Checked with a bareuv pip install .into a fresh venv:pytest 9.1.1comes along, and the same test file reports1 1 0. TheNo module named pytesterror still covers a custompython_paththat lacks it.Tests: the 8 new and changed tests in
test_test_harness.pyandtest_environment.pyall fail against the old code. Full suite:9 failed, 2371 passed, 2 skipped, and the 9 are exactly the ones #21 fixes.🤖 Generated with Claude Code
https://claude.ai/code/session_011FeZUmAZbyQWDJNAPkUA3S
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.