From f86a7ea36bd3b61de337ecc9c8e479fba8a050bf Mon Sep 17 00:00:00 2001
From: Philip Rosenberg-Watt
Date: Fri, 23 Mar 2018 09:39:36 -0600
Subject: [PATCH] Add requirements
---
homeassistant/components/calendar/google.py | 6 ++++--
requirements_all.txt | 1 +
requirements_test_all.txt | 7 ++++---
script/gen_requirements_all.py | 1 +
tests/components/calendar/test_google.py | 3 ++-
5 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/homeassistant/components/calendar/google.py b/homeassistant/components/calendar/google.py
index b62869fb940..39e18abcf9b 100644
--- a/homeassistant/components/calendar/google.py
+++ b/homeassistant/components/calendar/google.py
@@ -8,14 +8,14 @@ https://home-assistant.io/components/binary_sensor.google_calendar/
import logging
from datetime import timedelta
-from httplib2 import ServerNotFoundError
-
from homeassistant.components.calendar import CalendarEventDevice
from homeassistant.components.google import (
CONF_CAL_ID, CONF_ENTITIES, CONF_TRACK, TOKEN_FILE,
GoogleCalendarService)
from homeassistant.util import Throttle, dt
+REQUIREMENTS = ["httplib2==0.10.3"]
+
_LOGGER = logging.getLogger(__name__)
DEFAULT_GOOGLE_SEARCH_PARAMS = {
@@ -64,6 +64,8 @@ class GoogleCalendarData(object):
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Get the latest data."""
+ from httplib2 import ServerNotFoundError
+
try:
service = self.calendar_service.get()
except ServerNotFoundError:
diff --git a/requirements_all.txt b/requirements_all.txt
index f3637a40f64..c3c29c4fb3a 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -365,6 +365,7 @@ homematicip==0.8
http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a
# homeassistant.components.remember_the_milk
+# homeassistant.components.calendar.google
httplib2==0.10.3
# homeassistant.components.sensor.dht
diff --git a/requirements_test_all.txt b/requirements_test_all.txt
index b97eab335fb..11390969a91 100644
--- a/requirements_test_all.txt
+++ b/requirements_test_all.txt
@@ -83,6 +83,10 @@ holidays==0.9.4
# homeassistant.components.frontend
home-assistant-frontend==20180316.0
+# homeassistant.components.remember_the_milk
+# homeassistant.components.calendar.google
+httplib2==0.10.3
+
# homeassistant.components.influxdb
# homeassistant.components.sensor.influxdb
influxdb==5.0.0
@@ -201,6 +205,3 @@ warrant==0.6.1
# homeassistant.components.sensor.yahoo_finance
yahoo-finance==1.4.0
-
-# homeassistant.components.calendar.google
-httplib2==0.10.3
\ No newline at end of file
diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py
index d8fc7b1ed60..7c874f1b1e9 100755
--- a/script/gen_requirements_all.py
+++ b/script/gen_requirements_all.py
@@ -55,6 +55,7 @@ TEST_REQUIREMENTS = (
'hbmqtt',
'holidays',
'home-assistant-frontend',
+ 'httplib2',
'influxdb',
'libpurecoollink',
'libsoundtouch',
diff --git a/tests/components/calendar/test_google.py b/tests/components/calendar/test_google.py
index e3046434a56..e29c5f3b73a 100644
--- a/tests/components/calendar/test_google.py
+++ b/tests/components/calendar/test_google.py
@@ -5,7 +5,6 @@ import unittest
from unittest.mock import patch, Mock
import pytest
-from httplib2 import ServerNotFoundError
import homeassistant.components.calendar as calendar_base
import homeassistant.components.calendar.google as calendar
@@ -414,6 +413,8 @@ class TestComponentsGoogleCalendar(unittest.TestCase):
def test_update_false(self):
"""Test that the update returns False upon Error."""
+ from httplib2 import ServerNotFoundError
+
mock_service = Mock()
mock_service.get = Mock(side_effect=ServerNotFoundError("unit test"))