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>
19 lines
469 B
Python
19 lines
469 B
Python
"""Набор `repo_contract.py` на фейке; тот же набор на SQL —
|
|
`db/test_repo_contract_sql.py`."""
|
|
|
|
import pytest
|
|
|
|
from fakes import FakeDatabase, FakeUnitOfWork
|
|
from repo_contract import CHECKS
|
|
|
|
pytestmark = pytest.mark.anyio
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"check",
|
|
CHECKS,
|
|
ids=[check.__name__ for check in CHECKS],
|
|
)
|
|
async def test_repo_contract(check, database: FakeDatabase) -> None:
|
|
await check(lambda: FakeUnitOfWork(database))
|