21 lines
781 B
Python
21 lines
781 B
Python
"""Configuration SQLite mémoire partagée entre fixtures et helpers de tests.
|
|
|
|
Ce module est volontairement indépendant de ``conftest`` afin d'être
|
|
importable de manière portable, y compris sous ``pytest --import-mode=importlib``
|
|
(où ``conftest`` n'est pas importable comme module ordinaire). Il centralise la
|
|
configuration mémoire partagée entre la fixture ``app`` et les helpers de tests
|
|
qui appellent directement ``create_app(...)``, évitant qu'une factory de test
|
|
initialise accidentellement ``instance/worklog.db``.
|
|
"""
|
|
|
|
from sqlalchemy.pool import StaticPool
|
|
|
|
IN_MEMORY_DATABASE_URI = "sqlite:///:memory:"
|
|
|
|
|
|
def in_memory_engine_options() -> dict[str, object]:
|
|
return {
|
|
"poolclass": StaticPool,
|
|
"connect_args": {"check_same_thread": False},
|
|
}
|