From 03f80b100f64d8de198f94c6a54b046fa793680d Mon Sep 17 00:00:00 2001 From: Patrick Ogenstad Date: Tue, 24 Sep 2024 07:40:48 +0200 Subject: [PATCH] Fix test-processors type-hints (#974) --- pyproject.toml | 8 -------- tests/core/test_processors.py | 8 ++++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0d31152b..2859f1ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,14 +100,6 @@ disable_error_code = [ "index" ] -[[tool.mypy.overrides]] -module = "tests.core.test_processors" -disable_error_code = [ - "assignment", - "index", - "var-annotated" -] - [[tool.mypy.overrides]] module = "tests.wrapper" disable_error_code = [ diff --git a/tests/core/test_processors.py b/tests/core/test_processors.py index 1183a32f..54aa8c24 100644 --- a/tests/core/test_processors.py +++ b/tests/core/test_processors.py @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any, Dict, List from nornir.core import Nornir from nornir.core.inventory import Host @@ -40,7 +40,7 @@ def task_instance_completed(self, task: Task, host: Host, result: MultiResult) - self.data[task.name][host.name]["failed"] = result.failed def _get_subtask_dict(self, task: Task, host: Host) -> Dict[str, Any]: - parents = [] + parents: List[str] = [] parent = task.parent_task while True: if parent is None: @@ -65,7 +65,7 @@ def subtask_instance_completed(self, task: Task, host: Host, result: MultiResult class Test: def test_processor(self, nornir: Nornir) -> None: - data = {} + data: Dict[str, Any] = {} nornir.with_processors([MockProcessor(data)]).run(task=mock_task) assert data == { "mock_task": { @@ -111,7 +111,7 @@ def test_processor(self, nornir: Nornir) -> None: } def test_processor_subtasks(self, nornir: Nornir) -> None: - data = {} + data: Dict[str, Any] = {} nornir.with_processors([MockProcessor(data)]).run(task=mock_subtask) assert data == { "mock_subtask": {