test: standalone test container, isolated from the live prod stack
Adds a `test` stage to the Dockerfile (prod deps + pytest + aiosqlite via the `dev` extras, never shipped) and a docker-compose.test.yml that runs it under its own Compose project name (`cassandra-test`). The project-name isolation matters because this host runs prod — a wrong `compose up` would otherwise recreate the live `app` container; namespaced project means the test container can't touch any prod container/network/volume. Tests use an in-memory aiosqlite DB (per tests/conftest.py) so the container has no MariaDB / Redis dependency and nothing on the prod DB is observed or mutated. Also adds aiosqlite to dev extras — tests have always implicitly needed it (the conftest pins DATABASE_URL to sqlite+aiosqlite:///:memory:); the declaration was just missing. Usage: docker compose -f docker-compose.test.yml run --rm test docker compose -f docker-compose.test.yml run --rm test pytest -k unsubscribe
This commit is contained in:
parent
e338650dfa
commit
80e2ec53ac
3 changed files with 73 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ dev = [
|
|||
"pytest>=8.3",
|
||||
"pytest-asyncio>=0.24",
|
||||
"pytest-httpx>=0.34",
|
||||
"aiosqlite>=0.20",
|
||||
"ruff>=0.7",
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue