develop
Сергей Ванюшкин 2024-01-29 04:35:37 +03:00
parent 1b5182b41a
commit b5da5736e9
4 changed files with 6 additions and 4 deletions

View File

@ -2,7 +2,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings): class Settings(BaseSettings):
DB_HOST: str = "localhost" DB_HOST: str = "db"
DB_PORT: int = 5432 DB_PORT: int = 5432
POSTGRES_DB: str = "fastfod_db" POSTGRES_DB: str = "fastfod_db"
POSTGRES_PASSWORD: str = "postgres" POSTGRES_PASSWORD: str = "postgres"

View File

@ -26,7 +26,7 @@ class SubMenuCrud:
session.add(new_submenu) session.add(new_submenu)
await session.flush() await session.flush()
await session.commit() await session.commit()
return new_submenu return new_submenu
@staticmethod @staticmethod
async def get_submenu_item( async def get_submenu_item(

View File

@ -25,7 +25,10 @@ async_session_maker = async_sessionmaker(
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def event_loop(): def event_loop():
loop = asyncio.get_event_loop_policy().new_event_loop() try:
loop = asyncio.get_event_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
yield loop yield loop
loop.close() loop.close()

View File

@ -53,4 +53,3 @@ async def test_submenu(asession: AsyncSession) -> None:
submenu = await SubMenuCrud.create_submenu_item( submenu = await SubMenuCrud.create_submenu_item(
menu_id, menubaseschema.model_validate(submenu), asession, menu_id, menubaseschema.model_validate(submenu), asession,
) )
print(submenu)