diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77a2089b2..b70e4b43c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 20.8b1 hooks: - id: black args: diff --git a/requirements_tests.txt b/requirements_tests.txt index 36fa97d4c..b3dbf4efb 100644 --- a/requirements_tests.txt +++ b/requirements_tests.txt @@ -1,4 +1,4 @@ -black==19.10b0 +black==20.8b1 codecov==2.1.9 coverage==5.2.1 flake8-docstrings==1.5.0 diff --git a/supervisor/core.py b/supervisor/core.py index b61250e80..e2ce98af5 100644 --- a/supervisor/core.py +++ b/supervisor/core.py @@ -127,7 +127,8 @@ class Core(CoreSysAttributes): if self.sys_host.info.operating_system not in SUPERVISED_SUPPORTED_OS: self.supported = False _LOGGER.error( - "Detected unsupported OS: %s", self.sys_host.info.operating_system, + "Detected unsupported OS: %s", + self.sys_host.info.operating_system, ) # Check all DBUS connectivity diff --git a/supervisor/utils/gdbus.py b/supervisor/utils/gdbus.py index 54ddbcf2c..e1deec431 100644 --- a/supervisor/utils/gdbus.py +++ b/supervisor/utils/gdbus.py @@ -45,7 +45,9 @@ MAP_GDBUS_ERROR: Dict[str, Any] = { } # Commands for dbus -INTROSPECT: str = "gdbus introspect --system --dest {bus} " "--object-path {object} --xml" +INTROSPECT: str = ( + "gdbus introspect --system --dest {bus} " "--object-path {object} --xml" +) CALL: str = ( "gdbus call --system --dest {bus} --object-path {object} " "--method {method} {args}" diff --git a/tests/addons/test_options_schema.py b/tests/addons/test_options_schema.py index f44983adc..aaeba2e7e 100644 --- a/tests/addons/test_options_schema.py +++ b/tests/addons/test_options_schema.py @@ -34,32 +34,38 @@ def test_simple_schema(coresys): def test_complex_schema_list(coresys): """Test with complex list schema.""" assert validate_options( - coresys, {"name": "str", "password": "password", "extend": ["str"]}, + coresys, + {"name": "str", "password": "password", "extend": ["str"]}, )({"name": "Pascal", "password": "1234", "extend": ["test", "blu"]}) with pytest.raises(vol.error.Invalid): validate_options( - coresys, {"name": "str", "password": "password", "extend": ["str"]}, + coresys, + {"name": "str", "password": "password", "extend": ["str"]}, )({"name": "Pascal", "password": "1234", "extend": ["test", 1]}) with pytest.raises(vol.error.Invalid): validate_options( - coresys, {"name": "str", "password": "password", "extend": ["str"]}, + coresys, + {"name": "str", "password": "password", "extend": ["str"]}, )({"name": "Pascal", "password": "1234", "extend": "test"}) def test_complex_schema_dict(coresys): """Test with complex dict schema.""" assert validate_options( - coresys, {"name": "str", "password": "password", "extend": {"test": "int"}}, + coresys, + {"name": "str", "password": "password", "extend": {"test": "int"}}, )({"name": "Pascal", "password": "1234", "extend": {"test": 1}}) with pytest.raises(vol.error.Invalid): validate_options( - coresys, {"name": "str", "password": "password", "extend": {"test": "int"}}, + coresys, + {"name": "str", "password": "password", "extend": {"test": "int"}}, )({"name": "Pascal", "password": "1234", "extend": {"wrong": 1}}) with pytest.raises(vol.error.Invalid): validate_options( - coresys, {"name": "str", "password": "password", "extend": ["str"]}, + coresys, + {"name": "str", "password": "password", "extend": ["str"]}, )({"name": "Pascal", "password": "1234", "extend": "test"}) diff --git a/tests/conftest.py b/tests/conftest.py index 7548820ad..1e6490a79 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -49,7 +49,8 @@ def dbus() -> DBus: return load_fixture(fixture) with patch("supervisor.utils.gdbus.DBus._send", new=mock_send), patch( - "supervisor.dbus.interface.DBusInterface.is_connected", return_value=True, + "supervisor.dbus.interface.DBusInterface.is_connected", + return_value=True, ), patch("supervisor.utils.gdbus.DBus.get_properties", new=mock_get_properties): dbus_obj = DBus(DBUS_NAME_NM, DBUS_OBJECT_BASE) @@ -80,9 +81,11 @@ async def coresys(loop, docker, dbus, network_manager, aiohttp_client) -> CoreSy with patch("supervisor.bootstrap.initialize_system_data"), patch( "supervisor.bootstrap.setup_diagnostics" ), patch( - "supervisor.bootstrap.fetch_timezone", return_value="Europe/Zurich", + "supervisor.bootstrap.fetch_timezone", + return_value="Europe/Zurich", ), patch( - "aiohttp.ClientSession", return_value=TestClient.session, + "aiohttp.ClientSession", + return_value=TestClient.session, ): coresys_obj = await initialize_coresys() diff --git a/tests/discovery/test_ozw.py b/tests/discovery/test_ozw.py index b35b5657f..78aa7860c 100644 --- a/tests/discovery/test_ozw.py +++ b/tests/discovery/test_ozw.py @@ -10,7 +10,8 @@ def test_good_config(): """Test good zwave mqtt config.""" valid_discovery_config( - "ozw", {"host": "test", "port": 3812, "username": "bla", "password": "test"}, + "ozw", + {"host": "test", "port": 3812, "username": "bla", "password": "test"}, ) diff --git a/tests/utils/test_tarfile.py b/tests/utils/test_tarfile.py index 24f6116bb..c81386963 100644 --- a/tests/utils/test_tarfile.py +++ b/tests/utils/test_tarfile.py @@ -84,7 +84,10 @@ def test_create_pure_tar(): temp_tar = temp.joinpath("backup.tar") with SecureTarFile(temp_tar, "w") as tar_file: atomic_contents_add( - tar_file, temp_orig, excludes=[], arcname=".", + tar_file, + temp_orig, + excludes=[], + arcname=".", ) assert temp_tar.exists() @@ -117,7 +120,10 @@ def test_create_ecrypted_tar(): temp_tar = temp.joinpath("backup.tar") with SecureTarFile(temp_tar, "w", key=key) as tar_file: atomic_contents_add( - tar_file, temp_orig, excludes=[], arcname=".", + tar_file, + temp_orig, + excludes=[], + arcname=".", ) assert temp_tar.exists()