Skip to content

Commit

Permalink
Update requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
jdejaegh committed Dec 5, 2024
1 parent 972ab3f commit cf7519e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
aiohttp==3.10.10
aiohttp==3.11.9
async-timeout==4.0.3
homeassistant==2024.11.1
homeassistant==2024.12.0
voluptuous==0.15.2
svgwrite==1.4.3
aiofile==3.9.0
4 changes: 2 additions & 2 deletions requirements_tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
homeassistant==2024.11.1
pytest_homeassistant_custom_component==0.13.182
homeassistant==2024.12.0
pytest_homeassistant_custom_component==0.13.190
pytest
freezegun
isort
32 changes: 32 additions & 0 deletions tests/test_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ async def test_next_warning_when_data_available(
warning = IrmKmiNextWarning(coordinator, mock_config_entry)
warning.hass = hass

# This somehow fixes the following error that popped since 2024.12.0
# ValueError: Entity <class 'custom_components.irm_kmi.sensor.IrmKmiNextWarning'> cannot have a translation key for
# unit of measurement before being added to the entity platform
warning._attr_translation_key = None

assert warning.state == "2024-01-12T06:00:00+00:00"
assert len(warning.extra_state_attributes['next_warnings']) == 2

Expand All @@ -98,6 +103,11 @@ async def test_next_warning_none_when_only_active_warnings(
warning = IrmKmiNextWarning(coordinator, mock_config_entry)
warning.hass = hass

# This somehow fixes the following error that popped since 2024.12.0
# ValueError: Entity <class 'custom_components.irm_kmi.sensor.IrmKmiNextWarning'> cannot have a translation key for
# unit of measurement before being added to the entity platform
warning._attr_translation_key = None

assert warning.state is None
assert len(warning.extra_state_attributes['next_warnings']) == 0

Expand All @@ -115,6 +125,11 @@ async def test_next_warning_none_when_no_warnings(
warning = IrmKmiNextWarning(coordinator, mock_config_entry)
warning.hass = hass

# This somehow fixes the following error that popped since 2024.12.0
# ValueError: Entity <class 'custom_components.irm_kmi.sensor.IrmKmiNextWarning'> cannot have a translation key for
# unit of measurement before being added to the entity platform
warning._attr_translation_key = None

assert warning.state is None
assert len(warning.extra_state_attributes['next_warnings']) == 0

Expand All @@ -124,6 +139,11 @@ async def test_next_warning_none_when_no_warnings(
warning = IrmKmiNextWarning(coordinator, mock_config_entry)
warning.hass = hass

# This somehow fixes the following error that popped since 2024.12.0
# ValueError: Entity <class 'custom_components.irm_kmi.sensor.IrmKmiNextWarning'> cannot have a translation key for
# unit of measurement before being added to the entity platform
warning._attr_translation_key = None

assert warning.state is None
assert len(warning.extra_state_attributes['next_warnings']) == 0

Expand All @@ -146,6 +166,12 @@ async def test_next_sunrise_sunset(
sunset = IrmKmiNextSunMove(coordinator, mock_config_entry, 'sunset')
sunrise = IrmKmiNextSunMove(coordinator, mock_config_entry, 'sunrise')

# This somehow fixes the following error that popped since 2024.12.0
# ValueError: Entity <class 'custom_components.irm_kmi.sensor.IrmKmiNextSunMove'> cannot have a translation key for
# unit of measurement before being added to the entity platform
sunrise._attr_translation_key = None
sunset._attr_translation_key = None

assert datetime.fromisoformat(sunrise.state) == datetime.fromisoformat('2023-12-27T08:44:00+01:00')
assert datetime.fromisoformat(sunset.state) == datetime.fromisoformat('2023-12-27T16:43:00+01:00')

Expand All @@ -166,5 +192,11 @@ async def test_next_sunrise_sunset_bis(
sunset = IrmKmiNextSunMove(coordinator, mock_config_entry, 'sunset')
sunrise = IrmKmiNextSunMove(coordinator, mock_config_entry, 'sunrise')

# This somehow fixes the following error that popped since 2024.12.0
# ValueError: Entity <class 'custom_components.irm_kmi.sensor.IrmKmiNextSunMove'> cannot have a translation key for
# unit of measurement before being added to the entity platform
sunrise._attr_translation_key = None
sunset._attr_translation_key = None

assert datetime.fromisoformat(sunrise.state) == datetime.fromisoformat('2023-12-27T08:44:00+01:00')
assert datetime.fromisoformat(sunset.state) == datetime.fromisoformat('2023-12-26T16:42:00+01:00')

0 comments on commit cf7519e

Please sign in to comment.