You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tests): the plain-Python helper test fails in the Service image #4891
tests/invariants/test_hermetic_floor.py::test_a_support_helper_called_outside_pytest_writes_nothing (added by #4857) fails in the Service Image Tests job of ci.yml (shard 5 of 6, first seen on #4872):
assert 'no pytest run is active' in 'Traceback (most recent call last):
File "<string>", line 4, in <module>
from tests.support.tools import link_at_pin
...
File ".../tests/support/home_write_guard.py", line 45, in <module>
import pytest
ModuleNotFoundError: No module named 'pytest'
The test starts its child with python -I. In the Service image, pytest is not in /app/.venv: the job installs the dev packages into a mounted directory and adds it with PYTHONPATH=/opt/service-test/boot and a sitecustomize. -I ignores PYTHONPATH, so the child cannot import pytest and stops before the guard. In the devcontainer and in Tests & Coverage, pytest is in the venv, so the test passes there. #4857 changed no image content, so its pull request did not run the job.
Expected behavior
The child process imports the same pytest as the test process, and the test passes in the Service image too.
Steps to reproduce
Open a pull request that changes image content (for example Dockerfile), so that Service Image Tests runs.
Shard 5 of 6 fails on the test above.
Proposed fix
Keep -I, and give the child the directory of the parent's pytest: pass Path(pytest.__file__).parent.parent as an argument and put it on sys.path in the child script, beside REPO_ROOT.
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
Type: type/bug. The fix prefix of the title gives the type.
Scope: scope/tests. The (tests) scope of the title gives the scope.
Priority: P2-Medium. A CI test blocks PRs that change image content, but does not affect production users.
Value: Medium. It unblocks CI for image-related PRs and keeps the hermetic-floor test reliable.
Effort: Low. The proposed fix is to pass one directory path to the child and add it to sys.path.
Related: fix(tests): test helpers write to the real home outside pytest #4739, which asks for a different change. Both concern the test helper guard in tests/support, but #4739 fixes helpers writing to real home while the candidate fixes a test that cannot import pytest in a child process.
Same failure in run 43143507971 (workflow_dispatch of Service Image Tests on the branch of #4901, 2026-11-12): shard 5 of 6 failed only tests/invariants/test_hermetic_floor.py::test_a_support_helper_called_outside_pytest_writes_nothing with ModuleNotFoundError: No module named pytest in the child Python; 4202 tests of the shard passed. The other 5 shards passed.
Activity
dan-petty commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(tests)scope of the title gives the scope.A CI test blocks PRs that change image content, but does not affect production users.It unblocks CI for image-related PRs and keeps the hermetic-floor test reliable.The proposed fix is to pass one directory path to the child and add it to sys.path.Both concern the test helper guard in tests/support, but #4739 fixes helpers writing to real home while the candidate fixes a test that cannot import pytest in a child process.dan-petty commentedon Nov 12, 2026
Same failure in run 43143507971 (
workflow_dispatchof Service Image Tests on the branch of #4901, 2026-11-12): shard 5 of 6 failed onlytests/invariants/test_hermetic_floor.py::test_a_support_helper_called_outside_pytest_writes_nothingwithModuleNotFoundError: No module named pytestin the child Python; 4202 tests of the shard passed. The other 5 shards passed.devops-cli-service commentedon Nov 12, 2026
Released in v0.115.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.115.0
devops-cli-service commentedon Nov 12, 2026
Live since 2026-11-12 04:08 UTC