Open jesusch opened 7 months ago
given this code raises "RuntimeError: Event loop is closed" as soon as more then one test is performed
from typing import Optional
from unittest import IsolatedAsyncioTestCase
from odmantic import AIOEngine, Model, Field
class Publisher(Model):
name: str
founded: int = Field(ge=1440)
location: Optional[str] = None
engine = AIOEngine()
class TestPatients(IsolatedAsyncioTestCase):
async def test_one(self):
await engine.save(
Publisher(
name="Penguin",
founded=1935,
location="London"
)
)
async def test_two(self):
await engine.save(
Publisher(
name="Penguin",
founded=1935,
location="London"
)
)
If anyone interested - I started an example project which (still) fails https://github.com/jesusch/odmantic-test
Question
I'd really love to use odmantic/fastapi to replace my current database setup (dynamodb)
Yet any way I try to implement testcases seem to fail as mongomock doesn't support sessions
Any way to tell odmantic not to use them?