From bccd88039568546e281c14b87d11e57dfcd60228 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 7 Jan 2018 15:05:19 -0800 Subject: [PATCH] Fix canary flaky test (#11519) --- tests/components/sensor/test_canary.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/components/sensor/test_canary.py b/tests/components/sensor/test_canary.py index 99df05f36a4..b35b5630d60 100644 --- a/tests/components/sensor/test_canary.py +++ b/tests/components/sensor/test_canary.py @@ -1,10 +1,9 @@ """The tests for the Canary sensor platform.""" import copy import unittest -from unittest.mock import patch, Mock +from unittest.mock import Mock from canary.api import SensorType -from homeassistant.components import canary as base_canary from homeassistant.components.canary import DATA_CANARY from homeassistant.components.sensor import canary from homeassistant.components.sensor.canary import CanarySensor @@ -39,16 +38,13 @@ class TestCanarySensorSetup(unittest.TestCase): """Stop everything that was started.""" self.hass.stop() - @patch('homeassistant.components.canary.CanaryData') - def test_setup_sensors(self, mock_canary): + def test_setup_sensors(self): """Test the sensor setup.""" - base_canary.setup(self.hass, self.config) - online_device_at_home = mock_device(20, "Dining Room", True) offline_device_at_home = mock_device(21, "Front Yard", False) online_device_at_work = mock_device(22, "Office", True) - self.hass.data[DATA_CANARY] = mock_canary() + self.hass.data[DATA_CANARY] = Mock() self.hass.data[DATA_CANARY].locations = [ mock_location("Home", True, devices=[online_device_at_home, offline_device_at_home]),