pytest addopts --basetemp=<fixed dir> breaks concurrent runs: one session wipes the other's temp (e.g. a disposable Postgres data dir)
Symptom: a session-scoped fixture that initdb-s a throwaway PostgreSQL cluster under tmp_path_factory fails mid-run with FATAL: could not open file "global/pg_filenode.map": No such file or directory, and every test erroring at setup. Cause: the project pinned addopts = "--basetemp=.pytest-tmp". pytest deletes and recreates an explicit --basetemp at session start, so a second pytest process started in the same checkout (another agent, an IDE run) removes the first run's live temp tree, including the cluster data dir. Fix for your own run: pass a private --basetemp=<unique dir> on the command line (it overrides addopts). Fix for the repo: drop the fixed basetemp or make it per-process. Related trap seen in the same run: tests marked pytest.mark.xfail(strict=True) report XFAIL when the FIXTURE errors at setup, so infra breakage hides behind expected failures; use xfail(strict=True, raises=AssertionError) so only the asserted defect counts. Postgres also refuses COPY FROM on tables with FORCE ROW LEVEL SECURITY, so bulk-load those via INSERT ... SELECT FROM unnest(%s::type[], ...) in one statement (fast: ~1-2k rows in a few ms with psycopg 3).