Skip to content

fix(tests): the plain-Python helper test keeps PYTHONPATH - #4914

Merged
dan-petty merged 2 commits into
mainfrom
fix/4891-helper-test-service-image
Nov 12, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/4891-helper-test-service-image

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The plain-Python helper test of the hermetic floor (#4857) started its child process with python -I. -I drops PYTHONPATH. The Service image test job finds pytest and the test dependencies only on PYTHONPATH, so the child stopped at import pytest, and Service Image Tests failed on main and on the release pull request.

The child now starts with -P -s: the working directory stays off the import path, the user site directory stays out, and PYTHONPATH stays. The guard and the helpers do not change.

Closes #4891

Change: openspec/changes/archive/2026-11-12-4891-helper-test-keeps-pythonpath/

The test started its child with python -I, which drops PYTHONPATH. The
Service image test job finds pytest and the test dependencies only on
PYTHONPATH, so the child failed at import pytest. The child now starts
with -P -s: no working directory on the import path, no user site
directory, and PYTHONPATH kept.
@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/tests The test suite, its fixtures, fakes and floor labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Proof of the fix (fail-to-pass in the image layout).

devops ci fail-to-pass cannot show this failure: in the devcontainer the venv holds pytest, so the test passes on the base. This reproduction copies the image layout, where pytest is only on PYTHONPATH. It runs the test with the venv's base interpreter (cpython 3.14.10, no pytest) and puts pytest, src and the checkout only on PYTHONPATH:

base=$(readlink -f .venv/bin/python3)
PYTHONPATH="$PWD/src:$PWD:<venv>/lib/python3.14/site-packages" \
  $base -m pytest -q -p no:cacheprovider --no-cov -n0 \
  "tests/invariants/test_hermetic_floor.py::test_a_support_helper_called_outside_pytest_writes_nothing"
  • On origin/main (3b3fddc): 1 failed. The child stops with ModuleNotFoundError (here devops_cli, in the image pytest), because -I drops PYTHONPATH.
  • With this change: 1 passed.
  • In the normal environment (uv run pytest, same test): 1 passed.
  • Option check: PYTHONPATH=<dir> python3 -I -c 'import sys; print("<dir>" in sys.path)' prints False. With -P -s it prints True, and '' is not in sys.path.

Failure in CI: job 130899632355 of run 43132451416 (release PR #4875, head e88b2c7), shard 5 of 6.

PR CI runs Service Image Tests only when image content changes. The next main push and the release PR #4875 run that job after the merge.

@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 03:46
@dan-petty
dan-petty merged commit 99c109d into main Nov 12, 2026
26 checks passed
@dan-petty
dan-petty deleted the fix/4891-helper-test-service-image branch November 12, 2026 03:46
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.115.0](v0.114.1...v0.115.0)
(2026-11-12)


### Features

* **design:** add the design tokens and their build
([#4811](#4811))
([db4b19a](db4b19a))
* **roadmap:** find symbol definitions with tree-sitter
([#4820](#4820))
([3b3fddc](3b3fddc))


### Bug Fixes

* **ai:** the gateway group that answered decides the local label
([#4907](#4907))
([0da637f](0da637f))
* **ci:** replay a changed gate check in fail-to-pass
([#4898](#4898))
([59bfc57](59bfc57))
* **config:** read each config file as YAML 1.2
([#4858](#4858))
([c3130a3](c3130a3))
* **roadmap:** loosen the caps that turn a stage refusal into a loss
([#4869](#4869))
([4492fc3](4492fc3))
* **roadmap:** refine reads a dependency named by title
([#4877](#4877))
([2829f9c](2829f9c))
* **roadmap:** refine sends a judge refusal to an agent round
([#4874](#4874))
([e4fc6a9](e4fc6a9))
* **tests:** refuse test writes under the real home
([#4857](#4857))
([0f6ac1b](0f6ac1b))
* **tests:** the plain-Python helper test keeps PYTHONPATH
([#4914](#4914))
([99c109d](99c109d))


### Performance Improvements

* **ci:** direct pytest runs wait for a gate slot
([#4901](#4901))
([e80db62](e80db62))
* **roadmap:** status lane reads the snapshot, skips idle stops
([#4887](#4887))
([f285cf8](f285cf8))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/tests The test suite, its fixtures, fakes and floor type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tests): the plain-Python helper test fails in the Service image

1 participant