From f9e1409898de2567a297c150421d8367f185c1d3 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Mon, 17 Aug 2026 12:11:52 +0200 Subject: [PATCH] build(setup): prove the venv actually works instead of trusting pip's exit code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `make setup` created the venv and ran pip install, then exited 0 whether or not the result was usable — exactly D-24's failure shape, and the one this repo hit hardest: on 2026-08-09 there was no venv at all here while CLAUDE.md documented .venv/bin/python -m pytest as the way to run tests, and nothing in setup would have caught that state before a person did. Add a `pytest tests/ --collect-only -q` step at the end. It imports every test module and everything each one pulls in from src/, without running a single test, and fails the target on a broken interpreter or a broken dependency graph alike. Verified directly: - absent interpreter -> exit 127, target halts - apscheduler (declared, imported by src/main.py) uninstalled -> collect-only exits 4 with ModuleNotFoundError, target halts - make setup afterwards reinstalls it and collect-only exits 0, 189 tests collected, same count as before the mutation - idempotent: a warm rerun on an already-correct venv changes nothing and collects the same 189 tests, just faster (7s vs 30s cold) T-47 (workspace). Co-Authored-By: Claude --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 406d529..468bf99 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,18 @@ help: ## Show this help | awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-14s\033[0m %s\n", $$1, $$2}' .PHONY: setup -setup: ## Create the venv and install the test extra +setup: ## Create the venv, install the test extra, and prove it actually works $(PYTHON) -m venv .venv $(VENV)/bin/pip install -e ".[test]" + @# Exit 0 from `pip install` is not evidence (D-24) — pip reports success even + @# when the result is unusable. Prove the environment works instead of trusting + @# the install step: `--collect-only` imports every test module and therefore + @# every src module each one pulls in, which is exactly the failure mode this + @# target exists to catch (T-47 — this repo had no venv at all on 2026-08-09, + @# and the documented test command could not work). It runs zero tests, so it + @# stays cheap, and unlike a bare `import src.main` it exercises the tests/ + @# tree too, not just the package. + $(VENV)/bin/python -m pytest tests/ --collect-only -q .PHONY: test test: ## Run the test suite