ms_srs: fix numpy import
numpy is used in a few places in the class code so we need to jhave it
available in a bigger scope, while still only loading when needed.
Change-Id: Iea66e623e1c980a62d691e20dacb00df99fdd78f
diff --git a/src/osmo_gsm_tester/obj/ms_srs.py b/src/osmo_gsm_tester/obj/ms_srs.py
index 5805fef..4790e76 100644
--- a/src/osmo_gsm_tester/obj/ms_srs.py
+++ b/src/osmo_gsm_tester/obj/ms_srs.py
@@ -353,6 +353,8 @@
metrics = srsUEMetrics(self.metrics_file)
return metrics.verify(value, operation, metric, criterion)
+numpy = None
+
class srsUEMetrics(log.Origin):
VALID_OPERATIONS = ['avg', 'sum']
@@ -365,7 +367,10 @@
super().__init__(log.C_RUN, 'srsue_metrics')
self.raw_data = None
self.metrics_file = metrics_file
- import numpy
+ global numpy
+ if numpy is None:
+ import numpy as numpy_module
+ numpy = numpy_module
# read CSV, guessing data type with first row being the legend
try:
self.raw_data = numpy.genfromtxt(self.metrics_file, names=True, delimiter=';', dtype=None)