change that GameplayDatabase can have different backends, sqlite and postgresql with a Template example backend
This commit is contained in:
@@ -3,7 +3,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
import tempfile, sqlite3
|
||||
|
||||
from server.database import GameplayDatabase
|
||||
from server.database import GameplayDatabase, GameplayBackendBuilder
|
||||
|
||||
class TestGameplayDatabase(unittest.IsolatedAsyncioTestCase):
|
||||
def _build_state(self, turn:int, me_head:tuple[int, int], enemy_head:tuple[int, int], include_enemy:bool=True) -> dict:
|
||||
@@ -57,7 +57,7 @@ class TestGameplayDatabase(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_records_gameplay_with_wal_and_inferred_moves(self):
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
db_path = Path(temp_dir) / "gameplay.sqlite3"
|
||||
database = GameplayDatabase(str(db_path), busy_timeout_ms=4000)
|
||||
database = GameplayDatabase(GameplayBackendBuilder.build(db_path=str(db_path), busy_timeout_ms=4000))
|
||||
|
||||
await database.record_game_start(self._build_state(turn=0, me_head=(1, 1), enemy_head=(5, 5)))
|
||||
await database.record_turn(
|
||||
|
||||
Reference in New Issue
Block a user