mirror of
https://github.com/home-assistant/core.git
synced 2025-04-28 03:07:50 +00:00
Add python 3.7 to travis and tox (#14523)
* Add python 3.7 to travis and tox * Use pyyaml from github * Don't version constraints * Fix version tag * Change to new pyyaml release * Python 3.7 requires xenial * Fix namespace detection * Use correct RegEx type * Update pexpect to 4.6 * Use correct validation for dictionaries * Disable Py37 incompatible packages * Upgrade all pexpect to 4.6 * Add explicit None as default param
This commit is contained in:
parent
bd62248841
commit
02238b6412
@ -16,8 +16,9 @@ matrix:
|
|||||||
env: TOXENV=py35
|
env: TOXENV=py35
|
||||||
- python: "3.6"
|
- python: "3.6"
|
||||||
env: TOXENV=py36
|
env: TOXENV=py36
|
||||||
# - python: "3.6-dev"
|
- python: "3.7"
|
||||||
# env: TOXENV=py36
|
env: TOXENV=py37
|
||||||
|
dist: xenial
|
||||||
# allow_failures:
|
# allow_failures:
|
||||||
# - python: "3.5"
|
# - python: "3.5"
|
||||||
# env: TOXENV=typing
|
# env: TOXENV=typing
|
||||||
|
@ -16,7 +16,7 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
REQUIREMENTS = ['pexpect==4.0.1']
|
REQUIREMENTS = ['pexpect==4.6.0']
|
||||||
|
|
||||||
_DEVICES_REGEX = re.compile(
|
_DEVICES_REGEX = re.compile(
|
||||||
r'(?P<name>([^\s]+)?)\s+' +
|
r'(?P<name>([^\s]+)?)\s+' +
|
||||||
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
|||||||
CONF_HOST, CONF_PASSWORD, CONF_USERNAME, CONF_PORT, CONF_MODE,
|
CONF_HOST, CONF_PASSWORD, CONF_USERNAME, CONF_PORT, CONF_MODE,
|
||||||
CONF_PROTOCOL)
|
CONF_PROTOCOL)
|
||||||
|
|
||||||
REQUIREMENTS = ['pexpect==4.0.1']
|
REQUIREMENTS = ['pexpect==4.6.0']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME, \
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
REQUIREMENTS = ['pexpect==4.0.1']
|
REQUIREMENTS = ['pexpect==4.6.0']
|
||||||
|
|
||||||
PLATFORM_SCHEMA = vol.All(
|
PLATFORM_SCHEMA = vol.All(
|
||||||
PLATFORM_SCHEMA.extend({
|
PLATFORM_SCHEMA.extend({
|
||||||
|
@ -16,7 +16,7 @@ from homeassistant.const import (
|
|||||||
CONF_HOST, CONF_PASSWORD, CONF_USERNAME,
|
CONF_HOST, CONF_PASSWORD, CONF_USERNAME,
|
||||||
CONF_PORT)
|
CONF_PORT)
|
||||||
|
|
||||||
REQUIREMENTS = ['pexpect==4.0.1']
|
REQUIREMENTS = ['pexpect==4.6.0']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ from homeassistant.const import (STATE_OFF, STATE_PAUSED, STATE_PLAYING,
|
|||||||
STATE_IDLE)
|
STATE_IDLE)
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
|
|
||||||
REQUIREMENTS = ['pexpect==4.0.1']
|
REQUIREMENTS = ['pexpect==4.6.0']
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
# SUPPORT_VOLUME_SET is close to available but we need volume up/down
|
# SUPPORT_VOLUME_SET is close to available but we need volume up/down
|
||||||
|
@ -57,7 +57,7 @@ VACUUM_SET_FAN_SPEED_SERVICE_SCHEMA = VACUUM_SERVICE_SCHEMA.extend({
|
|||||||
|
|
||||||
VACUUM_SEND_COMMAND_SERVICE_SCHEMA = VACUUM_SERVICE_SCHEMA.extend({
|
VACUUM_SEND_COMMAND_SERVICE_SCHEMA = VACUUM_SERVICE_SCHEMA.extend({
|
||||||
vol.Required(ATTR_COMMAND): cv.string,
|
vol.Required(ATTR_COMMAND): cv.string,
|
||||||
vol.Optional(ATTR_PARAMS): vol.Any(cv.Dict, cv.ensure_list),
|
vol.Optional(ATTR_PARAMS): vol.Any(dict, cv.ensure_list),
|
||||||
})
|
})
|
||||||
|
|
||||||
SERVICE_TO_METHOD = {
|
SERVICE_TO_METHOD = {
|
||||||
|
@ -87,7 +87,8 @@ def get_component(hass, comp_or_platform) -> Optional[ModuleType]:
|
|||||||
# This prevents that when only
|
# This prevents that when only
|
||||||
# custom_components/switch/some_platform.py exists,
|
# custom_components/switch/some_platform.py exists,
|
||||||
# the import custom_components.switch would succeed.
|
# the import custom_components.switch would succeed.
|
||||||
if module.__spec__ and module.__spec__.origin == 'namespace':
|
# __file__ was unset for namespaces before Python 3.7
|
||||||
|
if getattr(module, '__file__', None) is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
_LOGGER.info("Loaded %s from %s", comp_or_platform, path)
|
_LOGGER.info("Loaded %s from %s", comp_or_platform, path)
|
||||||
|
@ -6,7 +6,7 @@ certifi>=2018.04.16
|
|||||||
jinja2>=2.10
|
jinja2>=2.10
|
||||||
pip>=8.0.3
|
pip>=8.0.3
|
||||||
pytz>=2018.04
|
pytz>=2018.04
|
||||||
pyyaml>=3.11,<4
|
pyyaml>=3.13,<4
|
||||||
requests==2.19.1
|
requests==2.19.1
|
||||||
voluptuous==0.11.1
|
voluptuous==0.11.1
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ certifi>=2018.04.16
|
|||||||
jinja2>=2.10
|
jinja2>=2.10
|
||||||
pip>=8.0.3
|
pip>=8.0.3
|
||||||
pytz>=2018.04
|
pytz>=2018.04
|
||||||
pyyaml>=3.11,<4
|
pyyaml>=3.13,<4
|
||||||
requests==2.19.1
|
requests==2.19.1
|
||||||
voluptuous==0.11.1
|
voluptuous==0.11.1
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ pdunehd==1.3
|
|||||||
# homeassistant.components.device_tracker.cisco_ios
|
# homeassistant.components.device_tracker.cisco_ios
|
||||||
# homeassistant.components.device_tracker.unifi_direct
|
# homeassistant.components.device_tracker.unifi_direct
|
||||||
# homeassistant.components.media_player.pandora
|
# homeassistant.components.media_player.pandora
|
||||||
pexpect==4.0.1
|
pexpect==4.6.0
|
||||||
|
|
||||||
# homeassistant.components.rpi_pfio
|
# homeassistant.components.rpi_pfio
|
||||||
pifacecommon==4.1.2
|
pifacecommon==4.1.2
|
||||||
|
@ -113,7 +113,7 @@ paho-mqtt==1.3.1
|
|||||||
# homeassistant.components.device_tracker.cisco_ios
|
# homeassistant.components.device_tracker.cisco_ios
|
||||||
# homeassistant.components.device_tracker.unifi_direct
|
# homeassistant.components.device_tracker.unifi_direct
|
||||||
# homeassistant.components.media_player.pandora
|
# homeassistant.components.media_player.pandora
|
||||||
pexpect==4.0.1
|
pexpect==4.6.0
|
||||||
|
|
||||||
# homeassistant.components.pilight
|
# homeassistant.components.pilight
|
||||||
pilight==0.1.1
|
pilight==0.1.1
|
||||||
|
2
setup.py
2
setup.py
@ -40,7 +40,7 @@ REQUIRES = [
|
|||||||
'jinja2>=2.10',
|
'jinja2>=2.10',
|
||||||
'pip>=8.0.3',
|
'pip>=8.0.3',
|
||||||
'pytz>=2018.04',
|
'pytz>=2018.04',
|
||||||
'pyyaml>=3.11,<4',
|
'pyyaml>=3.13,<4',
|
||||||
'requests==2.19.1',
|
'requests==2.19.1',
|
||||||
'voluptuous==0.11.1',
|
'voluptuous==0.11.1',
|
||||||
]
|
]
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
"""The tests for the MQTT component embedded server."""
|
"""The tests for the MQTT component embedded server."""
|
||||||
from unittest.mock import Mock, MagicMock, patch
|
from unittest.mock import Mock, MagicMock, patch
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from homeassistant.setup import setup_component
|
from homeassistant.setup import setup_component
|
||||||
import homeassistant.components.mqtt as mqtt
|
import homeassistant.components.mqtt as mqtt
|
||||||
@ -7,6 +10,9 @@ import homeassistant.components.mqtt as mqtt
|
|||||||
from tests.common import get_test_home_assistant, mock_coro
|
from tests.common import get_test_home_assistant, mock_coro
|
||||||
|
|
||||||
|
|
||||||
|
# Until https://github.com/beerfactory/hbmqtt/pull/139 is released
|
||||||
|
@pytest.mark.skipif(sys.version_info[:2] >= (3, 7),
|
||||||
|
reason='Package incompatible with Python 3.7')
|
||||||
class TestMQTT:
|
class TestMQTT:
|
||||||
"""Test the MQTT component."""
|
"""Test the MQTT component."""
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
"""The test for the geo rss events sensor platform."""
|
"""The test for the geo rss events sensor platform."""
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
import sys
|
||||||
|
|
||||||
import feedparser
|
import feedparser
|
||||||
|
import pytest
|
||||||
|
|
||||||
from homeassistant.setup import setup_component
|
from homeassistant.setup import setup_component
|
||||||
from tests.common import load_fixture, get_test_home_assistant
|
from tests.common import load_fixture, get_test_home_assistant
|
||||||
@ -22,6 +25,9 @@ VALID_CONFIG_WITHOUT_CATEGORIES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Until https://github.com/kurtmckee/feedparser/pull/131 is released.
|
||||||
|
@pytest.mark.skipif(sys.version_info[:2] >= (3, 7),
|
||||||
|
reason='Package incompatible with Python 3.7')
|
||||||
class TestGeoRssServiceUpdater(unittest.TestCase):
|
class TestGeoRssServiceUpdater(unittest.TestCase):
|
||||||
"""Test the GeoRss service updater."""
|
"""Test the GeoRss service updater."""
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ from yarl import URL
|
|||||||
|
|
||||||
from aiohttp.client_exceptions import ClientResponseError
|
from aiohttp.client_exceptions import ClientResponseError
|
||||||
|
|
||||||
|
retype = type(re.compile(''))
|
||||||
|
|
||||||
|
|
||||||
class AiohttpClientMocker:
|
class AiohttpClientMocker:
|
||||||
"""Mock Aiohttp client requests."""
|
"""Mock Aiohttp client requests."""
|
||||||
@ -40,7 +42,7 @@ class AiohttpClientMocker:
|
|||||||
if content is None:
|
if content is None:
|
||||||
content = b''
|
content = b''
|
||||||
|
|
||||||
if not isinstance(url, re._pattern_type):
|
if not isinstance(url, retype):
|
||||||
url = URL(url)
|
url = URL(url)
|
||||||
if params:
|
if params:
|
||||||
url = url.with_query(params)
|
url = url.with_query(params)
|
||||||
@ -146,7 +148,7 @@ class AiohttpClientMockResponse:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# regular expression matching
|
# regular expression matching
|
||||||
if isinstance(self._url, re._pattern_type):
|
if isinstance(self._url, retype):
|
||||||
return self._url.search(str(url)) is not None
|
return self._url.search(str(url)) is not None
|
||||||
|
|
||||||
if (self._url.scheme != url.scheme or self._url.host != url.host or
|
if (self._url.scheme != url.scheme or self._url.host != url.host or
|
||||||
|
Loading…
x
Reference in New Issue
Block a user