Skip to content

Commit 8f19b55

Browse files
author
Suganth Sadaiyappan
committed
fix pipeline failures and handle measurement data extra fields
1 parent bf437e6 commit 8f19b55

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

nisystemlink/clients/testmonitor/_test_monitor_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def delete_results(
205205
def create_steps(
206206
self,
207207
steps: List[models.CreateStepRequest],
208-
update_result_total_time: Optional[bool] = False,
208+
update_result_total_time: bool = False,
209209
) -> models.CreateStepsPartialSuccess:
210210
"""Creates one or more steps.
211211
@@ -297,9 +297,9 @@ def query_steps(self, query: models.QueryStepsRequest) -> models.PagedSteps:
297297
def update_steps(
298298
self,
299299
steps: List[models.UpdateStepRequest],
300-
update_result_total_time: Optional[bool] = False,
301-
replace_keywords: Optional[bool] = False,
302-
replace_properties: Optional[bool] = False,
300+
update_result_total_time: bool = False,
301+
replace_keywords: bool = False,
302+
replace_properties: bool = False,
303303
) -> models.UpdateStepsPartialSuccess:
304304
"""Updates one or more steps.
305305

nisystemlink/clients/testmonitor/models/_step_data.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
from typing import List, Optional
1+
from typing import Any, List, Optional
22

33
from nisystemlink.clients.core._uplink._json_model import JsonModel
4-
from nisystemlink.clients.testmonitor.models._status import Status
54
from pydantic import Extra
65

76

87
class Measurement(JsonModel):
98
name: Optional[str] = None
10-
status: Optional[Status] = None
9+
status: Optional[str] = None
1110
measurement: Optional[str] = None
1211
lowLimit: Optional[str] = None
1312
highLimit: Optional[str] = None
@@ -17,6 +16,13 @@ class Measurement(JsonModel):
1716
class Config:
1817
extra = Extra.allow
1918

19+
def __init__(self, **data: Any) -> None:
20+
# Convert all extra fields to str while keeping known fields unchanged
21+
processed_data = {
22+
k: str(v) if k not in self.__annotations__ else v for k, v in data.items()
23+
}
24+
super().__init__(**processed_data)
25+
2026

2127
class StepData(JsonModel):
2228
text: Optional[str] = None

tests/integration/testmonitor/test_testmonitor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ def test__update_step_data_and_inputs__data_and_inputs_updated(
710710
parameters=[
711711
Measurement(
712712
name="Current",
713-
status=Status.PASSED(),
713+
status="Passed",
714714
measurement="3.725",
715715
lowLimit="3.65",
716716
highLimit="3.8",
@@ -738,13 +738,14 @@ def test__update_step_data_and_inputs__data_and_inputs_updated(
738738
parameters=[
739739
Measurement(
740740
name="Voltage",
741-
status=Status.PASSED(),
741+
status="Passed",
742742
measurement="3.725",
743743
lowLimit="3.65",
744744
highLimit="3.8",
745745
units="V",
746746
comparisonType="GELE",
747747
specId="spec_01",
748+
specInfo={"specKey": "specValue"},
748749
)
749750
],
750751
)
@@ -753,7 +754,6 @@ def test__update_step_data_and_inputs__data_and_inputs_updated(
753754
NamedValue(name="Voltage", value="10"),
754755
]
755756
updated_outputs = [NamedValue(name="Current", value="4.725")]
756-
757757
update_response: UpdateStepsPartialSuccess = client.update_steps(
758758
steps=[
759759
UpdateStepRequest(

0 commit comments

Comments
 (0)