1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-05-08 08:58:31 +01:00

Update black 20.8b1 (#1976)

This commit is contained in:
Pascal Vizeli
2020-08-26 23:01:29 +02:00
committed by GitHub
parent 6e38216abd
commit 1a3b369dd7
8 changed files with 35 additions and 16 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 19.10b0
rev: 20.8b1
hooks:
- id: black
args:
+1 -1
View File
@@ -1,4 +1,4 @@
black==19.10b0
black==20.8b1
codecov==2.1.9
coverage==5.2.1
flake8-docstrings==1.5.0
+2 -1
View File
@@ -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
+3 -1
View File
@@ -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}"
+12 -6
View File
@@ -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"})
+6 -3
View File
@@ -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()
+2 -1
View File
@@ -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"},
)
+8 -2
View File
@@ -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()