Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
VENV="${CATHEDRAL_DEV_VENV:-$ROOT/.venv}"
PYTEST_PIN="pytest==8.3.0"
SETUPTOOLS_PIN="setuptools==80.9.0"

find_supported_python() {
if [ -n "${PYTHON:-}" ]; then echo "$PYTHON"; return; fi
Expand All @@ -45,7 +46,7 @@ if [ ! -x "$VENV/bin/python" ]; then
"$BASE" -m venv "$VENV"
fi
"$VENV/bin/python" -m pip install --quiet --upgrade pip
"$VENV/bin/python" -m pip install --quiet "$PYTEST_PIN"
"$VENV/bin/python" -m pip install --quiet "$PYTEST_PIN" "$SETUPTOOLS_PIN"

echo "provisioned $VENV"
echo " python: $("$VENV/bin/python" -V 2>&1)"
Expand Down
9 changes: 8 additions & 1 deletion tests/_bundle_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,14 @@ def _wheel(self, name: str, module: str, scripts: dict[str, str], extra_dep: str
f'[build-system]\nrequires=["setuptools"]\nbuild-backend="setuptools.build_meta"\n'
f'[project]\nname="{name}"\nversion="0.0.1"\n{dep}[project.scripts]\n{eps}'
f'[tool.setuptools.packages.find]\nwhere=["."]\n')
subprocess.run([str(self.trusted), "-m", "pip", "wheel", "--no-build-isolation", "--no-deps",
# Build the synthetic test wheels with the Gate 0 development
# environment. The trusted parent is intentionally a bare CPython on
# some supported hosts, including setup-python, and is tested as such by
# the real installer path below. Requiring a build backend in that bare
# parent makes every test fail during fixture setup before the installer
# is exercised. The development environment pins setuptools, so this
# remains reproducible and offline after provisioning.
subprocess.run([sys.executable, "-m", "pip", "wheel", "--no-build-isolation", "--no-deps",
"-w", str(self.wheelhouse), str(src)], check=True, capture_output=True)
Comment on lines +259 to 260

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reprovision existing environments before using the new backend

When a checkout already has a .venv created by the previous dev-env.sh—notably under Python 3.12, where the environment may contain pytest but no setuptools—run-gate0.sh skips provisioning because .venv/bin/python exists. This new sys.executable ... pip wheel --no-build-isolation path then still fails to import setuptools.build_meta, so updating the repository and rerunning the documented gate can reproduce the mass fixture errors this commit intends to fix. The runner should invoke provisioning unconditionally or explicitly verify/install the newly required backend before starting pytest.

Useful? React with 👍 / 👎.

return next(self.wheelhouse.glob(f"{name.replace('-', '_')}-*.whl"))

Expand Down
22 changes: 17 additions & 5 deletions tests/test_gate0.py
Original file line number Diff line number Diff line change
Expand Up @@ -5674,9 +5674,13 @@ def _crash_public_start(self, role: str, run_id: str):
"from test_gate0 import _StubEngine\n"
"class _LongRunning(_StubEngine):\n"
" def operate_argv(self, _cfg, *, dry_run=False):\n"
# A detached descendant plus a foreground process: killing the launcher
# leaves the descendant behind exactly as a real crash would.
" return ['/bin/sh', '-c', 'sleep 90 & sleep 120']\n"
# Run through the verified generation's regular-file interpreter, just
# like every production adapter runs a verified venv entrypoint. Using
# /bin/sh here made the fixture platform-dependent because it is a
# symlink on Ubuntu and the runtime correctly refuses symlinked launch
# targets with O_NOFOLLOW.
" body = 'import os,time\\nif os.fork() == 0: time.sleep(90)\\ntime.sleep(120)'\n"
" return [str(self.verified.bin('python')), '-c', body]\n"
" def operate_env(self, _cfg):\n"
" return {}\n"
" def child_env(self, _cfg=None):\n"
Expand Down Expand Up @@ -6548,7 +6552,11 @@ def _public_start(self, role: str, run_id: str, body: str):
"from test_gate0 import _StubEngine\n"
"class _Detaching(_StubEngine):\n"
" def operate_argv(self, _cfg, *, dry_run=False):\n"
f" return ['/usr/bin/python3', '-c', {body!r}, "
# Keep the fixture inside the same verified-generation boundary as the
# production adapters. /usr/bin/python3 is normally a symlink on
# Debian and Ubuntu, while signed release entrypoints are required to
# be regular files before a generation is admitted.
f" return [str(self.verified.bin('python')), '-c', {body!r}, "
f"{str(self.home / 'detached.pid')!r}]\n"
" def operate_env(self, _cfg):\n"
" return {}\n"
Expand Down Expand Up @@ -6584,7 +6592,11 @@ def test_a_detached_child_blocks_stop_deletion_and_a_second_start(self):
if ownership is not None and ownership.spawn_state == run_state.SPAWN_OWNED:
break
if launcher.poll() is not None:
self.fail(f"the public start exited early: {launcher.stderr.read()[:900]}")
self.fail(
"the public start exited early: "
f"stdout={launcher.stdout.read()[:900]} "
f"stderr={launcher.stderr.read()[:900]}"
)
time.sleep(0.1)
self.assertIsNotNone(ownership)

Expand Down
Loading