mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-14 20:56:30 +00:00
Update black 20.8b1 (#1976)
This commit is contained in:
parent
6e38216abd
commit
1a3b369dd7
@ -1,6 +1,6 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 19.10b0
|
rev: 20.8b1
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args:
|
args:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
black==19.10b0
|
black==20.8b1
|
||||||
codecov==2.1.9
|
codecov==2.1.9
|
||||||
coverage==5.2.1
|
coverage==5.2.1
|
||||||
flake8-docstrings==1.5.0
|
flake8-docstrings==1.5.0
|
||||||
|
@ -127,7 +127,8 @@ class Core(CoreSysAttributes):
|
|||||||
if self.sys_host.info.operating_system not in SUPERVISED_SUPPORTED_OS:
|
if self.sys_host.info.operating_system not in SUPERVISED_SUPPORTED_OS:
|
||||||
self.supported = False
|
self.supported = False
|
||||||
_LOGGER.error(
|
_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
|
# Check all DBUS connectivity
|
||||||
|
@ -45,7 +45,9 @@ MAP_GDBUS_ERROR: Dict[str, Any] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Commands for dbus
|
# 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 = (
|
CALL: str = (
|
||||||
"gdbus call --system --dest {bus} --object-path {object} "
|
"gdbus call --system --dest {bus} --object-path {object} "
|
||||||
"--method {method} {args}"
|
"--method {method} {args}"
|
||||||
|
@ -34,32 +34,38 @@ def test_simple_schema(coresys):
|
|||||||
def test_complex_schema_list(coresys):
|
def test_complex_schema_list(coresys):
|
||||||
"""Test with complex list schema."""
|
"""Test with complex list schema."""
|
||||||
assert validate_options(
|
assert validate_options(
|
||||||
coresys, {"name": "str", "password": "password", "extend": ["str"]},
|
coresys,
|
||||||
|
{"name": "str", "password": "password", "extend": ["str"]},
|
||||||
)({"name": "Pascal", "password": "1234", "extend": ["test", "blu"]})
|
)({"name": "Pascal", "password": "1234", "extend": ["test", "blu"]})
|
||||||
|
|
||||||
with pytest.raises(vol.error.Invalid):
|
with pytest.raises(vol.error.Invalid):
|
||||||
validate_options(
|
validate_options(
|
||||||
coresys, {"name": "str", "password": "password", "extend": ["str"]},
|
coresys,
|
||||||
|
{"name": "str", "password": "password", "extend": ["str"]},
|
||||||
)({"name": "Pascal", "password": "1234", "extend": ["test", 1]})
|
)({"name": "Pascal", "password": "1234", "extend": ["test", 1]})
|
||||||
|
|
||||||
with pytest.raises(vol.error.Invalid):
|
with pytest.raises(vol.error.Invalid):
|
||||||
validate_options(
|
validate_options(
|
||||||
coresys, {"name": "str", "password": "password", "extend": ["str"]},
|
coresys,
|
||||||
|
{"name": "str", "password": "password", "extend": ["str"]},
|
||||||
)({"name": "Pascal", "password": "1234", "extend": "test"})
|
)({"name": "Pascal", "password": "1234", "extend": "test"})
|
||||||
|
|
||||||
|
|
||||||
def test_complex_schema_dict(coresys):
|
def test_complex_schema_dict(coresys):
|
||||||
"""Test with complex dict schema."""
|
"""Test with complex dict schema."""
|
||||||
assert validate_options(
|
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}})
|
)({"name": "Pascal", "password": "1234", "extend": {"test": 1}})
|
||||||
|
|
||||||
with pytest.raises(vol.error.Invalid):
|
with pytest.raises(vol.error.Invalid):
|
||||||
validate_options(
|
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}})
|
)({"name": "Pascal", "password": "1234", "extend": {"wrong": 1}})
|
||||||
|
|
||||||
with pytest.raises(vol.error.Invalid):
|
with pytest.raises(vol.error.Invalid):
|
||||||
validate_options(
|
validate_options(
|
||||||
coresys, {"name": "str", "password": "password", "extend": ["str"]},
|
coresys,
|
||||||
|
{"name": "str", "password": "password", "extend": ["str"]},
|
||||||
)({"name": "Pascal", "password": "1234", "extend": "test"})
|
)({"name": "Pascal", "password": "1234", "extend": "test"})
|
||||||
|
@ -49,7 +49,8 @@ def dbus() -> DBus:
|
|||||||
return load_fixture(fixture)
|
return load_fixture(fixture)
|
||||||
|
|
||||||
with patch("supervisor.utils.gdbus.DBus._send", new=mock_send), patch(
|
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):
|
), patch("supervisor.utils.gdbus.DBus.get_properties", new=mock_get_properties):
|
||||||
|
|
||||||
dbus_obj = DBus(DBUS_NAME_NM, DBUS_OBJECT_BASE)
|
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(
|
with patch("supervisor.bootstrap.initialize_system_data"), patch(
|
||||||
"supervisor.bootstrap.setup_diagnostics"
|
"supervisor.bootstrap.setup_diagnostics"
|
||||||
), patch(
|
), patch(
|
||||||
"supervisor.bootstrap.fetch_timezone", return_value="Europe/Zurich",
|
"supervisor.bootstrap.fetch_timezone",
|
||||||
|
return_value="Europe/Zurich",
|
||||||
), patch(
|
), patch(
|
||||||
"aiohttp.ClientSession", return_value=TestClient.session,
|
"aiohttp.ClientSession",
|
||||||
|
return_value=TestClient.session,
|
||||||
):
|
):
|
||||||
coresys_obj = await initialize_coresys()
|
coresys_obj = await initialize_coresys()
|
||||||
|
|
||||||
|
@ -10,7 +10,8 @@ def test_good_config():
|
|||||||
"""Test good zwave mqtt config."""
|
"""Test good zwave mqtt config."""
|
||||||
|
|
||||||
valid_discovery_config(
|
valid_discovery_config(
|
||||||
"ozw", {"host": "test", "port": 3812, "username": "bla", "password": "test"},
|
"ozw",
|
||||||
|
{"host": "test", "port": 3812, "username": "bla", "password": "test"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,10 @@ def test_create_pure_tar():
|
|||||||
temp_tar = temp.joinpath("backup.tar")
|
temp_tar = temp.joinpath("backup.tar")
|
||||||
with SecureTarFile(temp_tar, "w") as tar_file:
|
with SecureTarFile(temp_tar, "w") as tar_file:
|
||||||
atomic_contents_add(
|
atomic_contents_add(
|
||||||
tar_file, temp_orig, excludes=[], arcname=".",
|
tar_file,
|
||||||
|
temp_orig,
|
||||||
|
excludes=[],
|
||||||
|
arcname=".",
|
||||||
)
|
)
|
||||||
|
|
||||||
assert temp_tar.exists()
|
assert temp_tar.exists()
|
||||||
@ -117,7 +120,10 @@ def test_create_ecrypted_tar():
|
|||||||
temp_tar = temp.joinpath("backup.tar")
|
temp_tar = temp.joinpath("backup.tar")
|
||||||
with SecureTarFile(temp_tar, "w", key=key) as tar_file:
|
with SecureTarFile(temp_tar, "w", key=key) as tar_file:
|
||||||
atomic_contents_add(
|
atomic_contents_add(
|
||||||
tar_file, temp_orig, excludes=[], arcname=".",
|
tar_file,
|
||||||
|
temp_orig,
|
||||||
|
excludes=[],
|
||||||
|
arcname=".",
|
||||||
)
|
)
|
||||||
|
|
||||||
assert temp_tar.exists()
|
assert temp_tar.exists()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user