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

Fix test-processors type-hints #974

Merged
merged 1 commit into from
Sep 24, 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
8 changes: 0 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
8 changes: 4 additions & 4 deletions tests/core/test_processors.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down