talos-access / backend /tests /test_db_engine_parity.py
Greg
test(integration): guard against accidental MariaDB/MySQL regressions
8d61b6c
Raw History Blame Contribute Delete
1.02 kB
"""Regression guard: ensure the running app only talks PostgreSQL."""
from app.core.database import engine
from app.core.config import settings
def test_engine_dialect_is_postgres():
"""The SQLAlchemy engine must use the postgresql dialect."""
assert engine.dialect.name == "postgresql", (
f"Expected postgresql dialect, got {engine.dialect.name}. "
"Something is reintroducing MariaDB/MySQL — check config.py and requirements.txt."
)
def test_database_url_does_not_contain_mysql():
"""No DATABASE_URL path should produce a mysql:// URL."""
assert "mysql" not in settings.DATABASE_URL.lower()
assert "pymysql" not in settings.DATABASE_URL.lower()
def test_pymysql_not_installed():
"""pymysql must not be importable — it was removed from requirements."""
import importlib
try:
importlib.import_module("pymysql")
raise AssertionError("pymysql is still installed. Run: pip uninstall pymysql")
except ImportError:
pass # expected