diff --git a/tests/test_binary_sensor.py b/tests/test_binary_sensor.py index 37f0a4d..c98cbac 100644 --- a/tests/test_binary_sensor.py +++ b/tests/test_binary_sensor.py @@ -50,13 +50,15 @@ async def test_yaml_binary_sensor( config["binary_sensors"][0]["name"] = name tz = dt_util.get_time_zone(NY_CONFIG["time_zone"]) - base_time = dt_util.now().astimezone(tz) + base_time = dt_util.now(tz) + print("tz", tz, "base_time", base_time, "local", datetime.now(), "dt_util.now()", dt_util.now()) # Set time to 00:00:00 tommorow. - now = datetime.combine((base_time + timedelta(1)).date(), time()).astimezone(tz) + now = datetime.combine((base_time + timedelta(1)).date(), time()).replace(tzinfo=tz) + print("now", now) with patch("homeassistant.util.dt.now", return_value=now): - print(dt_util.now()) + print("dt_util.now()", dt_util.now()) with assert_setup_component(1, DOMAIN): await async_setup_component(hass, DOMAIN, {DOMAIN: [config]}) await hass.async_block_till_done() @@ -77,6 +79,7 @@ async def test_yaml_binary_sensor( # Next change should be after midnight and before noon. next_change = state.attributes.get("next_change") noon = now.replace(hour=12) + print("next_change", next_change, "noon", noon) assert isinstance(next_change, datetime) assert now < next_change < noon