Skip to content

Commit

Permalink
fix: bad reference
Browse files Browse the repository at this point in the history
  • Loading branch information
mtache committed Jan 7, 2025
1 parent 50c3659 commit 9d3fe7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion anta/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ def __init__(
self.instance_commands: list[AntaCommand] = []
self.result: TestResult = TestResult.model_construct(name=device.name, test=self.name, categories=self.categories, description=self.description)
self._init_inputs(inputs)
self.result.inputs = self.inputs
if self.result.result == AntaTestStatus.UNSET:
self._init_commands(eos_data)

Expand Down Expand Up @@ -479,6 +478,7 @@ def _init_inputs(self, inputs: dict[str, Any] | AntaTest.Input | None) -> None:
if res_ow.description:
self.result.description = res_ow.description
self.result.custom_field = res_ow.custom_field
self.result.inputs = self.inputs

def _init_commands(self, eos_data: list[dict[Any, Any] | str] | None) -> None:
"""Instantiate the `instance_commands` instance attribute from the `commands` class attribute.
Expand Down
6 changes: 3 additions & 3 deletions anta/result_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from enum import Enum
from typing import Any

from pydantic import BaseModel, InstanceOf, SerializeAsAny, SkipValidation
from pydantic import BaseModel, InstanceOf, SerializeAsAny


class AntaTestStatus(str, Enum):
Expand Down Expand Up @@ -99,7 +99,7 @@ class AtomicTestResult(BaseTestResult):

_parent: TestResult
description: str
inputs: SkipValidation[SerializeAsAny[InstanceOf[BaseModel]]] | None = None
inputs: SerializeAsAny[InstanceOf[BaseModel]] | None = None
result: AntaTestStatus = AntaTestStatus.UNSET
messages: list[str] = []

Expand Down Expand Up @@ -157,7 +157,7 @@ class TestResult(BaseTestResult):
test: str
categories: list[str]
description: str
inputs: SkipValidation[SerializeAsAny[InstanceOf[BaseModel]]] | None = None # A TestResult inputs can be None in case of inputs validation error
inputs: SerializeAsAny[InstanceOf[BaseModel]] | None = None # A TestResult inputs can be None in case of inputs validation error
custom_field: str | None = None
result: AntaTestStatus = AntaTestStatus.UNSET
messages: list[str] = []
Expand Down

0 comments on commit 9d3fe7b

Please sign in to comment.