Files
Bobby NoelteandClaude Opus 5.5 f784773e46 test: stop on a disabled pytest cache, keep tests independent of the host
Additional changes
- Pin the cgroup CPU limit in the worker count test.
- Delete the generated _autosummary folders before the Sphinx build; the pattern missed them.
- Describe how to run pytest in the python-environment skill.
- Set the clock of the full-charge deadline tests in Europe/Berlin; they failed on hosts with another DST change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
2026-11-27 13:55:41 +01:00

3.1 KiB

name, description
name description
python-environment Use before running any Python, uv, pytest, mypy, ruff, pre-commit or make command. Keeps the agent's virtual environment out of the workspace .venv.

Python Environment

Why

The workspace may be shared with the developer's machine (e.g. a mounted directory or a container). The workspace .venv then belongs to the developer and is bound to an interpreter on their machine, which does not exist for the agent. uv treats such a .venv as broken: it deletes and recreates it for the agent's interpreter, which breaks the developer's environment, and the developer's next uv call breaks the agent's in turn (e.g. dev tools such as pytest or mypy go missing).

Rules

  • Never use, create, modify or delete the workspace .venv.

  • Use a virtual environment outside the workspace, selected by UV_PROJECT_ENVIRONMENT. In the AI development sandbox (ai/) it is already set for every shell and tool call; check with echo "$UV_PROJECT_ENVIRONMENT".

  • If it is not set, set it in every shell command that runs uv or make, e.g. export UV_PROJECT_ENVIRONMENT="$HOME/.cache/eos-venv" && <command>. Exported variables do not carry over between separate tool calls. Put the environment on a disk with enough space (it needs several hundred MB), not on a small tmpfs such as /tmp.

  • It applies to all commands that run Python through uv: uv sync, uv run ... (pytest, mypy, python scripts, pre-commit), and the make targets that use uv run (make mypy, make gen-docs, make test, ...).

  • Create or update the environment with the dev tools:

    uv sync --extra dev
    

    A plain uv sync (without --extra dev) removes pytest, mypy and the other dev tools from the environment.

  • Do not let a newer local uv rewrite uv.lock: use uv sync --frozen / uv run --frozen. When the lock must change (dependencies changed), lock with the uv version CI uses (.github/workflows/pre-commit.yml), e.g. uv tool run --from uv==<version> uv lock, and check that revision in uv.lock did not change.

  • Do not run commands that remove the workspace .venv, e.g. make clean (rm -rf build .venv) or rm -rf .venv.

Running pytest

  • Keep pytest's cache plugin: never pass -p no:cacheprovider. The server tests (pytest-xprocess) keep their processes in the cache; without it the run stops with a usage error. To skip the server tests, deselect them with -m "not eos_server".
  • Pytest's temporary files go to TMPDIR. In the sandbox /tmp is a 512 MB tmpfs that a full run fills: point TMPDIR to a directory on disk, e.g. TMPDIR="$HOME/.cache/eos-pytest-tmp".

Verify

  • uv run python -c "import sys; print(sys.prefix)" prints the environment outside the workspace, not <workspace>/.venv.
  • If uv reports Removed virtual environment at: .venv or Ignoring existing virtual environment linked to non-existent Python interpreter, the variable was not set: the workspace .venv was rebuilt. Do not try to repair it; tell the developer to run uv sync --extra dev on their machine.