From 25bfdbc8df383e801de977fa8ac1aba3fe1c3d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 5 Oct 2019 22:20:11 +0300 Subject: [PATCH] Require Python >= 3.6.1 (#27226) https://github.com/home-assistant/architecture/issues/278 --- homeassistant/bootstrap.py | 11 ----------- homeassistant/const.py | 2 +- tests/test_main.py | 29 ++++++++++++++++++++++++++++- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 7c4ec731b49b..ef2944911410 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -97,17 +97,6 @@ async def async_from_config_dict( stop = time() _LOGGER.info("Home Assistant initialized in %.2fs", stop - start) - if sys.version_info[:3] < (3, 6, 1): - msg = ( - "Python 3.6.0 support is deprecated and will " - "be removed in the first release after October 2. Please " - "upgrade Python to 3.6.1 or higher." - ) - _LOGGER.warning(msg) - hass.components.persistent_notification.async_create( - msg, "Python version", "python_version" - ) - return hass diff --git a/homeassistant/const.py b/homeassistant/const.py index 9baa4a1f71c1..e0f90834d943 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -4,7 +4,7 @@ MINOR_VERSION = 101 PATCH_VERSION = "0.dev0" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) -REQUIRED_PYTHON_VER = (3, 6, 0) +REQUIRED_PYTHON_VER = (3, 6, 1) # Format for platform files PLATFORM_FORMAT = "{platform}.{domain}" diff --git a/tests/test_main.py b/tests/test_main.py index 509425ce418a..29454d269af4 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -2,6 +2,7 @@ from unittest.mock import patch, PropertyMock from homeassistant import __main__ as main +from homeassistant.const import REQUIRED_PYTHON_VER @patch("sys.exit") @@ -31,6 +32,32 @@ def test_validate_python(mock_exit): mock_exit.reset_mock() - with patch("sys.version_info", new_callable=PropertyMock(return_value=(3, 6, 0))): + with patch( + "sys.version_info", + new_callable=PropertyMock( + return_value=(REQUIRED_PYTHON_VER[0] - 1,) + REQUIRED_PYTHON_VER[1:] + ), + ): + main.validate_python() + assert mock_exit.called is True + + mock_exit.reset_mock() + + with patch( + "sys.version_info", new_callable=PropertyMock(return_value=REQUIRED_PYTHON_VER) + ): main.validate_python() assert mock_exit.called is False + + mock_exit.reset_mock() + + with patch( + "sys.version_info", + new_callable=PropertyMock( + return_value=(REQUIRED_PYTHON_VER[:2]) + (REQUIRED_PYTHON_VER[2] + 1,) + ), + ): + main.validate_python() + assert mock_exit.called is False + + mock_exit.reset_mock()