All Stories
PyPIdata-exposed

Our Test Helper Called Production. It Wasn't Our Test Helper.

by Nils BergströmOct 31, 2026
Share storyHN

The setup

Our fixtures needed a database shim for Postgres-specific queries. The assistant pointed at pytest-django-helpers, which sounds like something we already had, so I pinned it without checking whether we did.

What it did

The fixture imported DATABASE_URL at collection time and opened a connection to production, then ran SELECT against the tables named in each test. Our tests only touched fixtures they created — but the helper read from whatever URL it found.

The tell

pytest --collect-only took nine seconds and logged a connection to the production host. Collection should touch nothing.

What I'd do differently

CI now runs tests with a network namespace that has no route to production. That would have caught it in the first run.

Involved package: pytest-django-helpersCheck in scanner →
Was this story helpful?