Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LKuemmel committed Nov 15, 2023
1 parent b11bc49 commit cd66c96
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
3 changes: 1 addition & 2 deletions packages/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
@pytest.fixture(autouse=True)
def mock_today(monkeypatch) -> None:
datetime_mock = MagicMock(wraps=datetime.datetime)
# Montag 16.05.2022, 8:40:52 "05/16/2022, 08:40:52"
# Zeitzonen GitHub: UTC, Raspberry: Europe/Berlin
# Montag 16.05.2022, 8:40:52 "05/16/2022, 08:40:52" Unix: 1652683252
datetime_mock.today.return_value = datetime.datetime(2022, 5, 16, 8, 40, 52)
monkeypatch.setattr(datetime, "datetime", datetime_mock)
mock_today_timestamp = Mock(return_value=1652683252)
Expand Down
5 changes: 3 additions & 2 deletions packages/control/ev_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Optional
from unittest.mock import Mock

import pytest
Expand All @@ -11,15 +12,15 @@

@pytest.mark.parametrize(
"check_timestamp, charge_state, soc_timestamp, expected_request_soc",
[pytest.param(False, False, 0, True, id="no soc_timestamp"),
[pytest.param(False, False, None, True, id="no soc_timestamp"),
pytest.param(True, False, 100, False, id="not charging, not expired"),
pytest.param(False, False, 100, True, id="not charging, expired"),
pytest.param(True, True, 100, False, id="charging, not expired"),
pytest.param(False, True, 100, True, id="charging, expired"),
])
def test_soc_interval_expired(check_timestamp: bool,
charge_state: bool,
soc_timestamp: float,
soc_timestamp: Optional[float],
expected_request_soc: bool,
monkeypatch):
# setup
Expand Down
7 changes: 0 additions & 7 deletions packages/helpermodules/timecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,6 @@ def is_list_valid(hour_list: List[int]) -> bool:
def check_timestamp(timestamp: int, duration: int) -> bool:
""" prüft, ob der Zeitstempel innerhalb der angegebenen Zeit liegt
Parameter
---------
timestamp: str
Zeitstempel, der geprüft werden soll
duration:
Zeitspanne in s, in der der Zeitstempel gültig ist
Return
------
True: Zeit ist noch nicht abgelaufen
Expand Down
2 changes: 1 addition & 1 deletion packages/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def handler_with_control_interval():
else:
self.interval_counter = self.interval_counter + 1
log.info("# ***Start*** ")
Pub().pub("openWB/set/system/time", timecheck.create_timestamp_unix())
Pub().pub("openWB/set/system/time", timecheck.create_timestamp())
handler_with_control_interval()
except KeyboardInterrupt:
log.critical("Ausführung durch exit_after gestoppt: "+traceback.format_exc())
Expand Down

0 comments on commit cd66c96

Please sign in to comment.