pip install로 Postgres 테스트 환경 구성 — Docker, Brew, apt 불필요
Pip install Postgres – no Docker/Brew/apt
Python/Pytest 테스트에서 쓸 수 있는 간단한 Postgres 헬퍼 라이브러리 'postgresql-testing'이 공개됐다. Docker나 Brew, apt 없이 pip install만으로 Postgres 바이너리를 받아 테스트용 DB를 띄운다. pytest 픽스처로 세션 단위 DB를 만들고, TEMPLATE나 아카이브에서 새 DB를 빠르게 복제하는 기능도 제공한다. 벤치마크에 따르면 테이블 100개짜리 DB를 템플릿에서 만드는 데 약 80ms, 아카이브에서 복원하는 데 150ms 수준이다. 로컬 우선 explain.dalibo.com 도구도 번들로 포함된다.
pip install 'postgresql-testing[15]' 한 줄이면 Docker나 Brew, apt 없이 Postgres 테스트 환경이 준비된다.