From c59dca754f062bd15f707df19757010cee86b802 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 1 Jul 2026 00:37:25 +0200 Subject: [PATCH] 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 --- CLAUDE.md | 12 ++++++------ config.py | 2 -- tests/__init__.py | 0 tests.py => tests/test_engine.py | 0 tests_history.py => tests/test_history.py | 0 test_socket.py => tests/test_socket.py | 0 6 files changed, 6 insertions(+), 8 deletions(-) delete mode 100644 config.py create mode 100644 tests/__init__.py rename tests.py => tests/test_engine.py (100%) rename tests_history.py => tests/test_history.py (100%) rename test_socket.py => tests/test_socket.py (100%) diff --git a/CLAUDE.md b/CLAUDE.md index 317ae19..86d1dbe 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -18,9 +18,9 @@ docker-compose up --build docker-compose down -v # also drops the pg volume — needed after a schema change # Tests -python -m unittest tests -v # pure-engine unittest (no deps) -python -m unittest tests_history -v # persistence + auth (needs sqlalchemy/aiosqlite/pyotp) -python -m unittest tests.StashCase.test_get_winner # single method +python -m unittest tests.test_engine -v # pure-engine unittest (no deps) +python -m unittest tests.test_history -v # persistence + auth (needs sqlalchemy/aiosqlite/pyotp) +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. @@ -31,7 +31,7 @@ Three independent layers, each usable without the one above it: **engine** (`bri ### 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`**. - **`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 -- New game-rule logic belongs in `bridzik.py` with a `unittest` case in `tests.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`. +- 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/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. diff --git a/config.py b/config.py deleted file mode 100644 index 7936e05..0000000 --- a/config.py +++ /dev/null @@ -1,2 +0,0 @@ -class Config(object): - SECRET_KEY = 'nbusr123' diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests.py b/tests/test_engine.py similarity index 100% rename from tests.py rename to tests/test_engine.py diff --git a/tests_history.py b/tests/test_history.py similarity index 100% rename from tests_history.py rename to tests/test_history.py diff --git a/test_socket.py b/tests/test_socket.py similarity index 100% rename from test_socket.py rename to tests/test_socket.py