fix(tests): isolate SQLite test databases
Co-authored-by: OpenAI/GPT-5.6-Terra <vibecoder@antoineve.me>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from app import create_app
|
||||
from tests.in_memory_db import IN_MEMORY_DATABASE_URI, in_memory_engine_options
|
||||
|
||||
_MINIMAL_CONFIG = """
|
||||
[vehicles.citadine]
|
||||
@@ -26,7 +27,11 @@ default_motor_vehicle_id = "{vehicle_id}"
|
||||
def _create_app_with_home_assistant_config(tmp_path, **values):
|
||||
config_path = tmp_path / "config.toml"
|
||||
config_path.write_text(_MINIMAL_CONFIG.format(**values), encoding="utf-8")
|
||||
return create_app(config_path=str(config_path))
|
||||
return create_app(
|
||||
config_path=str(config_path),
|
||||
database_uri=IN_MEMORY_DATABASE_URI,
|
||||
engine_options=in_memory_engine_options(),
|
||||
)
|
||||
|
||||
|
||||
def test_get_vehicles_returns_configured_vehicles(app):
|
||||
@@ -164,4 +169,8 @@ timezone = "Europe/Paris"
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="clé.*manquante"):
|
||||
create_app(config_path=str(config_path))
|
||||
create_app(
|
||||
config_path=str(config_path),
|
||||
database_uri=IN_MEMORY_DATABASE_URI,
|
||||
engine_options=in_memory_engine_options(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user