Change in osmo-gsm-tester[master]: ms_srs: fix numpy import

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon May 11 11:03:10 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18069 )

Change subject: ms_srs: fix numpy import
......................................................................

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
---
M src/osmo_gsm_tester/obj/ms_srs.py
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



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)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18069
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: Iea66e623e1c980a62d691e20dacb00df99fdd78f
Gerrit-Change-Number: 18069
Gerrit-PatchSet: 4
Gerrit-Owner: srs_andre <andre at softwareradiosystems.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200511/7e985cd2/attachment.htm>


More information about the gerrit-log mailing list