aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2021-09-28 14:59:28 +0200
committerVratko Polak <vrpolak@cisco.com>2021-10-06 08:50:26 +0000
commitb61c774897a6cce09bd597af6124831e8aea5e8c (patch)
tree81f8d4a01b24b1beb98a04a2efd24e43b11811cd /resources/libraries/python
parent78c59bd99bec595acbd24be8fb1c3337e4b41e56 (diff)
Fix: Do not touch PAPI history on bad DICT__nodes
Usually, DICT__nodes is populated from reserved topology yaml. But is some cases (doc generation, maybe pylint) there is no yaml. The proper fix is to never execute any business logic just when a module is imported. This is just a quick workaround. Ticket: CSIT-1793 Change-Id: I6d7250dc75d12baf120758ade8730af89431265a Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/PapiHistory.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/resources/libraries/python/PapiHistory.py b/resources/libraries/python/PapiHistory.py
index 65995ce8ef..32429c4f64 100644
--- a/resources/libraries/python/PapiHistory.py
+++ b/resources/libraries/python/PapiHistory.py
@@ -120,4 +120,9 @@ class PapiHistory:
PapiHistory.show_papi_history(node)
-PapiHistory.reset_papi_history_on_all_duts(DICT__nodes)
+# This module can be imported outside usual Robot test context,
+# e.g. in pylint or by tools generating docs from docstrings.
+# For the tools to work, we need to avoid processing
+# when DICT__nodes value is not usable.
+if DICT__nodes:
+ PapiHistory.reset_papi_history_on_all_duts(DICT__nodes)