mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Add MutexPool for recorder tests (#69410)
* Add MutexPool for recorder tests * Fix get_schema_version * Update test test_last_run_was_recently_clean * Update test test_shutdown_before_startup_finishes * Revert comments in test_write_lock_db * Make the MutexPool lock a class variable * Remove stale comment * Move MutexPool * Tweak debug prints
This commit is contained in:
@@ -84,12 +84,18 @@ def _default_recorder(hass):
|
||||
)
|
||||
|
||||
|
||||
async def test_shutdown_before_startup_finishes(hass):
|
||||
async def test_shutdown_before_startup_finishes(hass, tmp_path):
|
||||
"""Test shutdown before recorder starts is clean."""
|
||||
|
||||
# On-disk database because this test does not play nice with the
|
||||
# MutexPool
|
||||
config = {
|
||||
recorder.CONF_DB_URL: "sqlite:///" + str(tmp_path / "pytest.db"),
|
||||
recorder.CONF_COMMIT_INTERVAL: 1,
|
||||
}
|
||||
hass.state = CoreState.not_running
|
||||
|
||||
await async_init_recorder_component(hass)
|
||||
await async_init_recorder_component(hass, config)
|
||||
await hass.data[DATA_INSTANCE].async_db_ready
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user