Compare commits

1 Commits

Author SHA1 Message Date
tim c59dca754f Tidy up root-level files: drop dead config.py, group tests into tests/
- Remove config.py, an unused Flask SECRET_KEY leftover from before the
  legacy HTTP backend was replaced by the Socket.IO/ASGI server.
- Move tests.py / tests_history.py / test_socket.py into a tests/
  package as test_engine.py / test_history.py / test_socket.py, and
  update CLAUDE.md's documented commands to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-01 00:37:25 +02:00
6 changed files with 6 additions and 8 deletions
+6 -6
View File
@@ -18,9 +18,9 @@ docker-compose up --build
docker-compose down -v # also drops the pg volume — needed after a schema change docker-compose down -v # also drops the pg volume — needed after a schema change
# Tests # Tests
python -m unittest tests -v # pure-engine unittest (no deps) python -m unittest tests.test_engine -v # pure-engine unittest (no deps)
python -m unittest tests_history -v # persistence + auth (needs sqlalchemy/aiosqlite/pyotp) python -m unittest tests.test_history -v # persistence + auth (needs sqlalchemy/aiosqlite/pyotp)
python -m unittest tests.StashCase.test_get_winner # single method python -m unittest tests.test_engine.StashCase.test_get_winner # single method
``` ```
There is no linter or build step configured. The frontend is **only ever run via Docker** — never `npm install`/`npm run dev` on the host. There is no linter or build step configured. The frontend is **only ever run via Docker** — never `npm install`/`npm run dev` on the host.
@@ -31,7 +31,7 @@ Three independent layers, each usable without the one above it: **engine** (`bri
### Game engine — `bridzik.py` ### Game engine — `bridzik.py`
Pure Python, **no Flask/Socket.IO/DB dependency**. All game rules live here and are exercised directly by `tests.py`. State is a strict nested hierarchy, each level enforcing turn order and completion before delegating down: Pure Python, **no Flask/Socket.IO/DB dependency**. All game rules live here and are exercised directly by `tests/test_engine.py`. State is a strict nested hierarchy, each level enforcing turn order and completion before delegating down:
- **`Bridzik`** — a whole game = exactly **4 `Series`**. - **`Bridzik`** — a whole game = exactly **4 `Series`**.
- **`Series`** — exactly **8 `Round`s**; the starting player rotates per series/round. - **`Series`** — exactly **8 `Round`s**; the starting player rotates per series/round.
@@ -75,6 +75,6 @@ React + Vite PWA (zustand store, react-router, socket.io-client, `qrcode.react`)
## Conventions ## Conventions
- New game-rule logic belongs in `bridzik.py` with a `unittest` case in `tests.py` — keep the engine free of Flask/Socket.IO/DB. - New game-rule logic belongs in `bridzik.py` with a `unittest` case in `tests/test_engine.py` — keep the engine free of Flask/Socket.IO/DB.
- Persistence/auth logic goes in `db/` (data primitives) and `api/history.py` + `api/auth.py` (logic that uses them); cover it in `tests_history.py`, not `tests.py`. - Persistence/auth logic goes in `db/` (data primitives) and `api/history.py` + `api/auth.py` (logic that uses them); cover it in `tests/test_history.py`, not `tests/test_engine.py`.
- Raise `BridzikException` (Slovak message) for rule violations; the API catches it and re-emits a Slovak error. Auth errors use `AuthError` the same way. - Raise `BridzikException` (Slovak message) for rule violations; the API catches it and re-emits a Slovak error. Auth errors use `AuthError` the same way.
-2
View File
@@ -1,2 +0,0 @@
class Config(object):
SECRET_KEY = 'nbusr123'
View File
View File