Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint: fix untyped-defs on /tests/unittest/cmd #5800

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloudinit/cmd/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class StatusDetails(NamedTuple):
recoverable_errors: Dict[str, List[str]]
last_update: str
datasource: Optional[str]
v1: Dict[str, Dict]
v1: Dict[str, Any]


TABULAR_LONG_TMPL = """\
Expand Down
5 changes: 0 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ module = [
"cloudinit.user_data",
"tests.integration_tests.instances",
"tests.unittests.analyze.test_show",
"tests.unittests.cmd.devel.test_hotplug_hook",
"tests.unittests.cmd.devel.test_render",
"tests.unittests.cmd.test_clean",
"tests.unittests.cmd.test_query",
"tests.unittests.cmd.test_status",
"tests.unittests.config.test_apt_configure_sources_list_v1",
"tests.unittests.config.test_apt_configure_sources_list_v3",
"tests.unittests.config.test_apt_source_v1",
Expand Down
10 changes: 9 additions & 1 deletion tests/unittests/cmd/devel/test_hotplug_hook.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections import namedtuple
from typing import Any, NamedTuple
from unittest import mock
from unittest.mock import call

Expand All @@ -19,6 +20,13 @@
FAKE_MAC = "11:22:33:44:55:66"


class Mocks(NamedTuple):
m_init: Any
m_network_state: Any
m_activator: Any
m_sleep: Any


@pytest.fixture
def mocks():
m_init = mock.MagicMock(spec=Init)
Expand Down Expand Up @@ -54,7 +62,7 @@ def mocks():
parse_net.start()
m_sleep = sleep.start()

yield namedtuple("mocks", "m_init m_network_state m_activator m_sleep")(
yield Mocks(
m_init=m_init,
m_network_state=m_network_state,
m_activator=m_activator,
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/cmd/devel/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_invalid_jinja_syntax(self, caplog, tmpdir):
assert (
JinjaSyntaxParsingException.format_error_message(
syntax_error="unexpected '}'",
line_number=2,
line_number="2",
line_content="rendering: {{ my_var } }",
)
in caplog.text
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/cmd/test_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def fake_subp(cmd, capture):
return "", ""

myargs = namedtuple(
"MyArgs", "remove_logs remove_seed remove_config reboot machine_id"
"myargs", "remove_logs remove_seed remove_config reboot machine_id"
)
cmdargs = myargs(
remove_logs=False,
Expand Down Expand Up @@ -382,7 +382,7 @@ def test_handle_clean_args_removed_machine_id(
"""handle_clean_args removes /etc/machine-id when arg is True."""
uses_systemd.return_value = systemd_val
myargs = namedtuple(
"MyArgs", "remove_logs remove_seed remove_config reboot machine_id"
"myargs", "remove_logs remove_seed remove_config reboot machine_id"
)
cmdargs = myargs(
remove_logs=False,
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/cmd/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def test_handle_args_invalid_jinja_exception(self, caplog, tmpdir, capsys):
"Failed to render templated data. "
+ JinjaSyntaxParsingException.format_error_message(
syntax_error="unexpected '}'",
line_number=2,
line_number="2",
line_content="v1_1: {{ v1.v1_1 } }",
)
)
Expand Down
1 change: 1 addition & 0 deletions tools/.github-cla-signers
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Vultaire
waveform80
WebSpider
weizhouapache
wideawakening
Wind-net
wmousa
wschoot
Expand Down