Skip to content

Commit 7779052

Browse files
sshediclaude
andcommitted
typing: fix mypy annotation errors in test_user_data_normalize
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
1 parent fa8dcfc commit 7779052

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ module = [
8989
"tests.unittests.config.test_cc_zypper_add_repo",
9090
"tests.unittests.config.test_modules",
9191
"tests.unittests.config.test_schema",
92-
"tests.unittests.distros.test_user_data_normalize",
9392
"tests.unittests.helpers",
9493
"tests.unittests.net.test_dhcp",
9594
"tests.unittests.net.test_init",

tests/unittests/distros/test_user_data_normalize.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# This file is part of cloud-init. See LICENSE file for license information.
2+
from typing import Any, Dict
23
from unittest import mock
34

45
import pytest
56

67
from cloudinit import distros, helpers, settings
78
from cloudinit.distros import ug_util
89

9-
bcfg = {
10+
bcfg: Dict[str, Any] = {
1011
"name": "bob",
1112
"plain_text_passwd": "ubuntu",
1213
"home": "/home/ubuntu",
@@ -19,7 +20,7 @@
1920

2021
class TestUGNormalize:
2122
def _make_distro(self, dtype, def_user=None):
22-
cfg = dict(settings.CFG_BUILTIN)
23+
cfg: Dict[str, Any] = dict(settings.CFG_BUILTIN)
2324
cfg["system_info"]["distro"] = dtype
2425
paths = helpers.Paths(cfg["system_info"]["paths"])
2526
distro_cls = distros.fetch(dtype)
@@ -141,7 +142,7 @@ def test_users_simple(self):
141142

142143
def test_users_old_user(self):
143144
distro = self._make_distro("ubuntu", bcfg)
144-
ug_cfg = {"user": "zetta", "users": "default"}
145+
ug_cfg: Dict[str, Any] = {"user": "zetta", "users": "default"}
145146
users, _groups = self._norm(ug_cfg, distro)
146147
assert "bob" not in users # Bob is not the default now, zetta is
147148
assert "zetta" in users
@@ -214,7 +215,7 @@ def test_users_dict_override_default_attribute(self):
214215
# matches the passed config: False
215216
assert users["bob"][key] is False
216217
elif key == "groups":
217-
assert users["bob"][key] == ",".join(val)
218+
assert users["bob"][key] == ",".join(list(val))
218219
elif key != "name":
219220
assert users["bob"][key] == val
220221

@@ -231,7 +232,7 @@ def test_users_dict_extract(self):
231232
assert "bob" in users
232233
name, config = ug_util.extract_default(users)
233234
assert name == "bob"
234-
expected_config = {}
235+
expected_config: Dict[str, Any] = {}
235236
def_config = None
236237
try:
237238
def_config = distro.get_default_user()

0 commit comments

Comments
 (0)