File size: 1,017 Bytes
8d61b6c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""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