From 8bce9be59040f5c3a7b64010abda7abc115d361a Mon Sep 17 00:00:00 2001
From: "J. Nick Koston" <nick@koston.org>
Date: Thu, 2 Jul 2020 12:51:31 -0500
Subject: [PATCH] Fix flapping flux tests (#37346)

---
 tests/components/flux/test_switch.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tests/components/flux/test_switch.py b/tests/components/flux/test_switch.py
index f10029a6469..cc194f4f14a 100644
--- a/tests/components/flux/test_switch.py
+++ b/tests/components/flux/test_switch.py
@@ -124,7 +124,7 @@ async def test_invalid_config_no_lights(hass):
         )
 
 
-async def test_flux_when_switch_is_off(hass):
+async def test_flux_when_switch_is_off(hass, legacy_patchable_time):
     """Test the flux switch when it is off."""
     platform = getattr(hass.components, "test.light")
     platform.init()
@@ -174,7 +174,7 @@ async def test_flux_when_switch_is_off(hass):
     assert not turn_on_calls
 
 
-async def test_flux_before_sunrise(hass):
+async def test_flux_before_sunrise(hass, legacy_patchable_time):
     """Test the flux switch before sunrise."""
     platform = getattr(hass.components, "test.light")
     platform.init()
@@ -228,7 +228,7 @@ async def test_flux_before_sunrise(hass):
     assert call.data[light.ATTR_XY_COLOR] == [0.606, 0.379]
 
 
-async def test_flux_before_sunrise_known_location(hass):
+async def test_flux_before_sunrise_known_location(hass, legacy_patchable_time):
     """Test the flux switch before sunrise."""
     platform = getattr(hass.components, "test.light")
     platform.init()
@@ -500,7 +500,7 @@ async def test_flux_with_custom_start_stop_times(hass, legacy_patchable_time):
     assert call.data[light.ATTR_XY_COLOR] == [0.504, 0.385]
 
 
-async def test_flux_before_sunrise_stop_next_day(hass):
+async def test_flux_before_sunrise_stop_next_day(hass, legacy_patchable_time):
     """Test the flux switch before sunrise.
 
     This test has the stop_time on the next day (after midnight).
@@ -680,7 +680,9 @@ async def test_flux_after_sunset_before_midnight_stop_next_day(
 
 
 # pylint: disable=invalid-name
-async def test_flux_after_sunset_after_midnight_stop_next_day(hass):
+async def test_flux_after_sunset_after_midnight_stop_next_day(
+    hass, legacy_patchable_time
+):
     """Test the flux switch after sunset and before stop.
 
     This test has the stop_time on the next day (after midnight).
@@ -738,7 +740,9 @@ async def test_flux_after_sunset_after_midnight_stop_next_day(hass):
 
 
 # pylint: disable=invalid-name
-async def test_flux_after_stop_before_sunrise_stop_next_day(hass):
+async def test_flux_after_stop_before_sunrise_stop_next_day(
+    hass, legacy_patchable_time
+):
     """Test the flux switch after stop and before sunrise.
 
     This test has the stop_time on the next day (after midnight).
-- 
GitLab