Really ensure recorder test fixture is setup before hass fixture (#87796)
This commit is contained in:
parent
db503c0daa
commit
2fae82a9ef
3 changed files with 20 additions and 18 deletions
|
@ -324,7 +324,7 @@ async def test_saving_state_with_intermixed_time_changes(
|
|||
assert db_states[0].event_id is None
|
||||
|
||||
|
||||
def test_saving_state_with_exception(hass, hass_recorder, caplog):
|
||||
def test_saving_state_with_exception(hass_recorder, hass, caplog):
|
||||
"""Test saving and restoring a state."""
|
||||
hass = hass_recorder()
|
||||
|
||||
|
@ -362,7 +362,7 @@ def test_saving_state_with_exception(hass, hass_recorder, caplog):
|
|||
assert "Error saving events" not in caplog.text
|
||||
|
||||
|
||||
def test_saving_state_with_sqlalchemy_exception(hass, hass_recorder, caplog):
|
||||
def test_saving_state_with_sqlalchemy_exception(hass_recorder, hass, caplog):
|
||||
"""Test saving state when there is an SQLAlchemyError."""
|
||||
hass = hass_recorder()
|
||||
|
||||
|
@ -430,7 +430,7 @@ async def test_force_shutdown_with_queue_of_writes_that_generate_exceptions(
|
|||
assert "Error saving events" not in caplog.text
|
||||
|
||||
|
||||
def test_saving_event(hass, hass_recorder):
|
||||
def test_saving_event(hass_recorder):
|
||||
"""Test saving and restoring an event."""
|
||||
hass = hass_recorder()
|
||||
|
||||
|
@ -690,7 +690,7 @@ def test_saving_state_include_domain_glob_exclude_entity(hass_recorder):
|
|||
assert _state_with_context(hass, "test.ok").state == "state2"
|
||||
|
||||
|
||||
def test_saving_state_and_removing_entity(hass, hass_recorder):
|
||||
def test_saving_state_and_removing_entity(hass_recorder):
|
||||
"""Test saving the state of a removed entity."""
|
||||
hass = hass_recorder()
|
||||
entity_id = "lock.mine"
|
||||
|
@ -1255,7 +1255,7 @@ def test_has_services(hass_recorder):
|
|||
assert hass.services.has_service(DOMAIN, SERVICE_PURGE_ENTITIES)
|
||||
|
||||
|
||||
def test_service_disable_events_not_recording(hass, hass_recorder):
|
||||
def test_service_disable_events_not_recording(hass_recorder):
|
||||
"""Test that events are not recorded when recorder is disabled using service."""
|
||||
hass = hass_recorder()
|
||||
|
||||
|
@ -1330,7 +1330,7 @@ def test_service_disable_events_not_recording(hass, hass_recorder):
|
|||
)
|
||||
|
||||
|
||||
def test_service_disable_states_not_recording(hass, hass_recorder):
|
||||
def test_service_disable_states_not_recording(hass_recorder):
|
||||
"""Test that state changes are not recorded when recorder is disabled using service."""
|
||||
hass = hass_recorder()
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ def _get_native_states(hass, entity_id):
|
|||
]
|
||||
|
||||
|
||||
async def test_schema_update_calls(hass: HomeAssistant, recorder_db_url: str) -> None:
|
||||
async def test_schema_update_calls(recorder_db_url: str, hass: HomeAssistant) -> None:
|
||||
"""Test that schema migrations occur in correct order."""
|
||||
assert recorder.util.async_migration_in_progress(hass) is False
|
||||
|
||||
|
@ -75,7 +75,7 @@ async def test_schema_update_calls(hass: HomeAssistant, recorder_db_url: str) ->
|
|||
)
|
||||
|
||||
|
||||
async def test_migration_in_progress(hass: HomeAssistant, recorder_db_url: str) -> None:
|
||||
async def test_migration_in_progress(recorder_db_url: str, hass: HomeAssistant) -> None:
|
||||
"""Test that we can check for migration in progress."""
|
||||
if recorder_db_url.startswith("mysql://"):
|
||||
# The database drop at the end of this test currently hangs on MySQL
|
||||
|
@ -104,7 +104,7 @@ async def test_migration_in_progress(hass: HomeAssistant, recorder_db_url: str)
|
|||
|
||||
|
||||
async def test_database_migration_failed(
|
||||
hass: HomeAssistant, recorder_db_url: str
|
||||
recorder_db_url: str, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test we notify if the migration fails."""
|
||||
assert recorder.util.async_migration_in_progress(hass) is False
|
||||
|
@ -137,7 +137,7 @@ async def test_database_migration_failed(
|
|||
|
||||
|
||||
async def test_database_migration_encounters_corruption(
|
||||
hass: HomeAssistant, recorder_db_url: str
|
||||
recorder_db_url: str, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test we move away the database if its corrupt."""
|
||||
if recorder_db_url.startswith(("mysql://", "postgresql://")):
|
||||
|
@ -174,7 +174,7 @@ async def test_database_migration_encounters_corruption(
|
|||
|
||||
|
||||
async def test_database_migration_encounters_corruption_not_sqlite(
|
||||
hass: HomeAssistant, recorder_db_url: str
|
||||
recorder_db_url: str, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test we fail on database error when we cannot recover."""
|
||||
assert recorder.util.async_migration_in_progress(hass) is False
|
||||
|
@ -210,7 +210,7 @@ async def test_database_migration_encounters_corruption_not_sqlite(
|
|||
|
||||
|
||||
async def test_events_during_migration_are_queued(
|
||||
hass: HomeAssistant, recorder_db_url: str
|
||||
recorder_db_url: str, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test that events during migration are queued."""
|
||||
|
||||
|
@ -246,7 +246,7 @@ async def test_events_during_migration_are_queued(
|
|||
|
||||
|
||||
async def test_events_during_migration_queue_exhausted(
|
||||
hass: HomeAssistant, recorder_db_url: str
|
||||
recorder_db_url: str, hass: HomeAssistant
|
||||
) -> None:
|
||||
"""Test that events during migration takes so long the queue is exhausted."""
|
||||
|
||||
|
@ -290,7 +290,7 @@ async def test_events_during_migration_queue_exhausted(
|
|||
[(0, True), (16, True), (18, True), (22, True), (25, True)],
|
||||
)
|
||||
async def test_schema_migrate(
|
||||
hass: HomeAssistant, recorder_db_url: str, start_version, live
|
||||
recorder_db_url: str, hass: HomeAssistant, start_version, live
|
||||
):
|
||||
"""Test the full schema migration logic.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue