Freeze timezone in bmw_connected_drive tests (#113533)
Freeze timezone in bmw_connected_drive
This commit is contained in:
parent
066594b25b
commit
66aa2c038a
1 changed files with 3 additions and 17 deletions
|
@ -1,8 +1,6 @@
|
|||
"""Test BMW diagnostics."""
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
@ -20,7 +18,7 @@ from tests.components.diagnostics import (
|
|||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11))
|
||||
@pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11, tzinfo=datetime.UTC))
|
||||
async def test_config_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
|
@ -29,10 +27,6 @@ async def test_config_entry_diagnostics(
|
|||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
|
||||
# Make sure that local timezone for test is UTC
|
||||
os.environ["TZ"] = "UTC"
|
||||
time.tzset()
|
||||
|
||||
mock_config_entry = await setup_mocked_integration(hass)
|
||||
|
||||
diagnostics = await get_diagnostics_for_config_entry(
|
||||
|
@ -42,7 +36,7 @@ async def test_config_entry_diagnostics(
|
|||
assert diagnostics == snapshot
|
||||
|
||||
|
||||
@pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11))
|
||||
@pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11, tzinfo=datetime.UTC))
|
||||
async def test_device_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
|
@ -52,10 +46,6 @@ async def test_device_diagnostics(
|
|||
) -> None:
|
||||
"""Test device diagnostics."""
|
||||
|
||||
# Make sure that local timezone for test is UTC
|
||||
os.environ["TZ"] = "UTC"
|
||||
time.tzset()
|
||||
|
||||
mock_config_entry = await setup_mocked_integration(hass)
|
||||
|
||||
reg_device = device_registry.async_get_device(
|
||||
|
@ -70,7 +60,7 @@ async def test_device_diagnostics(
|
|||
assert diagnostics == snapshot
|
||||
|
||||
|
||||
@pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11))
|
||||
@pytest.mark.freeze_time(datetime.datetime(2022, 7, 10, 11, tzinfo=datetime.UTC))
|
||||
async def test_device_diagnostics_vehicle_not_found(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
|
@ -80,10 +70,6 @@ async def test_device_diagnostics_vehicle_not_found(
|
|||
) -> None:
|
||||
"""Test device diagnostics when the vehicle cannot be found."""
|
||||
|
||||
# Make sure that local timezone for test is UTC
|
||||
os.environ["TZ"] = "UTC"
|
||||
time.tzset()
|
||||
|
||||
mock_config_entry = await setup_mocked_integration(hass)
|
||||
|
||||
reg_device = device_registry.async_get_device(
|
||||
|
|
Loading…
Add table
Reference in a new issue