fix(model): Remove test logic from model 62/42962/1
authorPeter Mikus <[email protected]>
Thu, 15 May 2025 05:50:00 +0000 (07:50 +0200)
committerPeter Mikus <[email protected]>
Thu, 15 May 2025 05:50:00 +0000 (07:50 +0200)
Signed-off-by: Peter Mikus <[email protected]>
Change-Id: Ife334a4611ec2ca683764746fab280dc403d1de8

resources/libraries/python/model/ExportJson.py
resources/libraries/python/model/ExportResult.py

index a83bf5e..1eb0d58 100644 (file)
@@ -367,10 +367,6 @@ class ExportJson():
         result_type = result_node["type"]
         if result_type == "unknown":
             # Device or something else not supported.
-            # Also could be MRR with all trials negative, write as a failure.
-            self.data["passed"] = False
-            self.data["message"] = "No result exported."
-            # TODO: Raise real Robot error after writing this JSON.
             return
 
         # Compute avg and stdev for mrr (rate and bandwidth).
index b751e59..3cbb435 100644 (file)
@@ -100,7 +100,7 @@ def append_mrr_value(mrr_value, mrr_unit, bandwidth_value=None,
         bandwidth_unit="bps"):
     """Store mrr value to proper place so it is dumped into json.
 
-    Raises an error if the arguments would lead to invalid json.
+    The value is appended only when unit is not empty.
 
     :param mrr_value: Forwarding rate from MRR trial.
     :param mrr_unit: Unit of measurement for the rate.
@@ -109,22 +109,19 @@ def append_mrr_value(mrr_value, mrr_unit, bandwidth_value=None,
     :type mrr_unit: str
     :type bandwidth_value: Optional[float]
     :type bandwidth_unit: Optional[str]
-    :raises RuntimeError: If mrr_unit is missing or any value is negative.
     """
     if not mrr_unit:
-        raise RuntimeError(f"Cannot be falsey: {mrr_unit=}")
+        return
     data = get_export_data()
     data["result"]["type"] = "mrr"
+
     for node_val, node_unit, node_name in ((mrr_value, mrr_unit, "rate"),
             (bandwidth_value, bandwidth_unit, "bandwidth")):
         if node_val is not None:
-            node_val = float(node_val)
-            if node_val < 0:
-                raise RuntimeError(f"Cannot be negative: {node_val=}")
             node = descend(descend(data["result"], "receive_rate"), node_name)
             node["unit"] = str(node_unit)
             values_list = descend(node, "values", list)
-            values_list.append(node_val)
+            values_list.append(float(node_val))
 
 
 def export_search_bound(text, value, unit, bandwidth=None):