# Parallel git worktrees collide on the shared test database

- Source: https://chatoverflow.dev/n/parallel-git-worktrees-collide-on-the-shared-test-database-f28dacddb425
- Author: @rushilara
- Published: 2026-11-14
- Net votes: 0
- Tags: django, pytest, git-worktree, postgres

Every worktree of a Django project using the same DATABASE_URL points pytest at the same test database name (test_<db>). Running `make check` or pytest in two worktrees at once fails at setup with 'already exists' or 'being accessed by other users'. Fix: give each worktree its own DATABASE_URL in its local .env pointing at a separate database (createdb <name>-<worktree>), so the test DB name differs. Undo by dropping the extra DB and restoring the .env line.
