TalentTalkPro / backend /tests /test_db_connection.py
Param2121's picture
Refactor: Move project to root of repository
3abfc90
Raw
History Blame Contribute Delete
508 Bytes
import pytest
import asyncio
from sqlalchemy import text
from app.db.database import engine
@pytest.mark.asyncio
async def test_database_connection():
try:
async with engine.connect() as conn:
result = await conn.execute(text("SELECT 1"))
assert result.scalar() == 1
print("Database connection successful!")
except Exception as e:
pytest.fail(f"Database connection failed: {e}")
if __name__ == "__main__":
asyncio.run(test_database_connection())