From c4de9fdcbeca6075574b578e05916a08231647af Mon Sep 17 00:00:00 2001 From: Tsvi Mostovicz Date: Tue, 4 Jun 2024 16:13:56 +0000 Subject: [PATCH] Remove flaky tests --- .../jewish_calendar/test_config_flow.py | 46 +------------------ 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/tests/components/jewish_calendar/test_config_flow.py b/tests/components/jewish_calendar/test_config_flow.py index 83cc233bb89..3189571a5a7 100644 --- a/tests/components/jewish_calendar/test_config_flow.py +++ b/tests/components/jewish_calendar/test_config_flow.py @@ -1,6 +1,5 @@ """Test the Jewish calendar config flow.""" -from datetime import timedelta from unittest.mock import AsyncMock import pytest @@ -10,7 +9,6 @@ from homeassistant.components.jewish_calendar.const import ( CONF_CANDLE_LIGHT_MINUTES, CONF_DIASPORA, CONF_HAVDALAH_OFFSET_MINUTES, - DEFAULT_CANDLE_LIGHT, DEFAULT_DIASPORA, DEFAULT_LANGUAGE, DOMAIN, @@ -27,9 +25,8 @@ from homeassistant.const import ( from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType from homeassistant.setup import async_setup_component -import homeassistant.util.dt as dt_util -from tests.common import MockConfigEntry, async_fire_time_changed +from tests.common import MockConfigEntry async def test_step_user(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> None: @@ -141,44 +138,3 @@ async def test_options(hass: HomeAssistant, mock_config_entry: MockConfigEntry) assert len(entries) == 1 assert entries[0].options[CONF_CANDLE_LIGHT_MINUTES] == 25 assert entries[0].options[CONF_HAVDALAH_OFFSET_MINUTES] == 34 - - -async def test_options_reconfigure( - hass: HomeAssistant, mock_config_entry: MockConfigEntry -) -> None: - """Test that updating the options of the Jewish Calendar integration triggers a value update.""" - mock_config_entry.add_to_hass(hass) - await hass.config_entries.async_setup(mock_config_entry.entry_id) - await hass.async_block_till_done() - - future = dt_util.utcnow() + timedelta(seconds=30) - async_fire_time_changed(hass, future) - await hass.async_block_till_done() - - # Get the value of the "upcoming_shabbat_candle_lighting" sensor - initial_sensor_value = hass.states.get( - "sensor.jewish_calendar_upcoming_shabbat_candle_lighting" - ).state - initial_sensor_value = dt_util.parse_datetime(initial_sensor_value) - - # Update the CONF_CANDLE_LIGHT_MINUTES option to a new value - result = await hass.config_entries.options.async_init(mock_config_entry.entry_id) - result = await hass.config_entries.options.async_configure( - result["flow_id"], - user_input={ - CONF_CANDLE_LIGHT_MINUTES: DEFAULT_CANDLE_LIGHT + 1, - }, - ) - - future = dt_util.utcnow() + timedelta(seconds=30) - async_fire_time_changed(hass, future) - await hass.async_block_till_done() - - # The sensor value should have changed to be one minute later - new_sensor_value = hass.states.get( - "sensor.jewish_calendar_upcoming_shabbat_candle_lighting" - ).state - new_sensor_value = dt_util.parse_datetime(new_sensor_value) - - # Verify that the new sensor value is one minute later - assert abs(new_sensor_value - initial_sensor_value) == timedelta(minutes=1)