refactor: move services to a unit of work over repository ports
Services depend only on src/core/ports: async with self.uow is one transaction, commit is explicit, leaving without it rolls back. A connection is held per step, the JSON routers keep a shared request deadline, and rollback runs under the block deadline. Adds service-tests with fakes, a repo contract run on both the fake and SQL, and make service_test / service_test_db. API, schema and settings are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -238,6 +238,10 @@ access_log=False)`. Импорты в `src/__main__.py` — внутри `if __n
|
||||
- `student_test` передаёт pytest `EXPECT_REPLICAS` (по умолчанию
|
||||
`API_REPLICAS`): сколько реплик за `BASE_URL` ждут тесты реплик.
|
||||
Против одного процесса — `EXPECT_REPLICAS=1` (`student-tests.md`).
|
||||
- Быстрые тесты (`service-tests.md`): `service_test` — `uv run pytest -c
|
||||
service-tests/pytest.ini service-tests/unit`, без хранилищ и docker;
|
||||
`service_test_db: start_db` — `service-tests/db` на временной базе в PostgreSQL
|
||||
стенда.
|
||||
- `test_isolated: env_setup start_db start_cache start_s3` — образ на
|
||||
временной базе (`student-tests.md`); Valkey и S3 общие с рабочим
|
||||
стендом, ключи кэша и объектов разделены именем базы, префикс
|
||||
|
||||
Reference in New Issue
Block a user