Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
josiasmontag committed Aug 19, 2024
1 parent 070860e commit 1bf6719
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test binary sensor for DWD rain radar integration."""
import os
import time

import pytest
from unittest.mock import AsyncMock, patch, MagicMock
Expand All @@ -24,6 +25,17 @@ def entity_registry_enabled_by_default() -> Generator[None]:
):
yield

@pytest.fixture(autouse=True)
def set_timezone():
os.environ['TZ'] = 'Europe/Berlin' # Set to your desired timezone
time.tzset() # Apply the timezone setting

yield # Run the test

# Cleanup after the test
del os.environ['TZ']
time.tzset()

@pytest.mark.asyncio
@patch('httpx.AsyncClient.get', new_callable=AsyncMock)
@freeze_time("2024-08-08T15:47:00", tz_offset=2)
Expand Down
12 changes: 12 additions & 0 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test sensor for DWD rain radar integration."""
import os
import time

import pytest
from unittest.mock import AsyncMock, patch, MagicMock
Expand All @@ -24,6 +25,17 @@ def entity_registry_enabled_by_default() -> Generator[None]:
):
yield

@pytest.fixture(autouse=True)
def set_timezone():
os.environ['TZ'] = 'Europe/Berlin' # Set to your desired timezone
time.tzset() # Apply the timezone setting

yield # Run the test

# Cleanup after the test
del os.environ['TZ']
time.tzset()

@pytest.mark.asyncio
@patch('httpx.AsyncClient.get', new_callable=AsyncMock)
@freeze_time("2024-08-08T15:47:00", tz_offset=2)
Expand Down

0 comments on commit 1bf6719

Please sign in to comment.