From ea3383e9a4dcead5c286df7c0d5b8b402fd5b000 Mon Sep 17 00:00:00 2001 From: Andreas Date: Wed, 16 Sep 2026 13:25:29 +0200 Subject: [PATCH] test(measurement): isolate capacity database state between tests --- tests/test_battery_capacity.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_battery_capacity.py b/tests/test_battery_capacity.py index e0ba2666..96ba9f03 100644 --- a/tests/test_battery_capacity.py +++ b/tests/test_battery_capacity.py @@ -161,6 +161,7 @@ async def database_case(config_eos): from akkudoktoreos.core.coreabc import get_measurement from akkudoktoreos.measurement.quality import MeasurementSample + get_measurement()._db_reset_state() config_eos.merge_settings_from_dict( { "devices": { @@ -197,7 +198,10 @@ async def database_case(config_eos): for t in (0, 1800, 3600) ] )) - return config_eos + try: + yield config_eos + finally: + get_measurement()._db_reset_state() def test_http_reads_database_and_stores_only_explicit_estimate(database_case):