fix pylint issues

This commit is contained in:
Mike Degatano 2023-04-28 13:59:36 -04:00
parent 6867c357fe
commit a1dcd7fb7f
6 changed files with 12 additions and 10 deletions

View File

@ -41,7 +41,9 @@ def systemd_errors(func):
return await func(*args, **kwds)
except DBusFatalError as err:
if err.type == DBUS_ERR_SYSTEMD_NO_SUCH_UNIT:
# pylint: disable=raise-missing-from
raise DBusSystemdNoSuchUnit(str(err))
# pylint: enable=raise-missing-from
raise err
return wrapper

View File

@ -87,7 +87,7 @@ class MountManager(FileConfiguration, CoreSysAttributes):
*[mount.load() for mount in mounts], return_exceptions=True
)
for i in range(len(errors)):
for i in range(len(errors)): # pylint: disable=consider-using-enumerate
if not errors[i]:
continue
if not isinstance(errors[i], MountError):

View File

@ -81,7 +81,7 @@ async def test_api_create_error_mount_exists(api_client: TestClient, mount):
"share": "backups",
},
)
resp.status == 400
assert resp.status == 400
result = await resp.json()
assert result["result"] == "error"
assert result["message"] == "A mount already exists with name backup_test"
@ -128,7 +128,7 @@ async def test_api_update_error_mount_missing(api_client: TestClient):
"share": "new_backups",
},
)
resp.status == 400
assert resp.status == 400
result = await resp.json()
assert result["result"] == "error"
assert result["message"] == "No mount exists with name backup_test"
@ -153,7 +153,7 @@ async def test_api_reload_mount(
async def test_api_reload_error_mount_missing(api_client: TestClient):
"""Test reload mount API errors when mount does not exist."""
resp = await api_client.post("/mounts/backup_test/reload")
resp.status == 400
assert resp.status == 400
result = await resp.json()
assert result["result"] == "error"
assert result["message"] == "No mount exists with name backup_test"
@ -176,7 +176,7 @@ async def test_api_delete_mount(api_client: TestClient, coresys: CoreSys, mount)
async def test_api_delete_error_mount_missing(api_client: TestClient):
"""Test delete mount API errors when mount does not exist."""
resp = await api_client.delete("/mounts/backup_test")
resp.status == 400
assert resp.status == 400
result = await resp.json()
assert result["result"] == "error"
assert result["message"] == "No mount exists with name backup_test"

View File

@ -13,7 +13,7 @@ def setup(object_path: str | None = None) -> DBusServiceMock:
return Systemd()
# pylint: disable=invalid-name,missing-function-docstring
# pylint: disable=invalid-name,missing-function-docstring,raising-bad-type
class Systemd(DBusServiceMock):

View File

@ -391,8 +391,8 @@ async def test_save_data(coresys: CoreSys, tmp_supervisor_data: Path, path_exter
coresys.mounts.save_data()
assert path.exists()
with path.open() as f:
config = json.load(f)
with path.open() as file:
config = json.load(file)
assert config["mounts"] == [
{
"name": "auth_test",

View File

@ -42,7 +42,7 @@ async def test_cifs_mount(
}
mount: CIFSMount = Mount.from_dict(coresys, mount_data)
assert type(mount) == CIFSMount
assert isinstance(mount, CIFSMount)
assert mount.name == "test"
assert mount.type == MountType.CIFS
assert mount.usage == MountUsage.MEDIA
@ -102,7 +102,7 @@ async def test_nfs_mount(
}
mount: NFSMount = Mount.from_dict(coresys, mount_data)
assert type(mount) == NFSMount
assert isinstance(mount, NFSMount)
assert mount.name == "test"
assert mount.type == MountType.NFS
assert mount.usage == MountUsage.MEDIA