Change in osmo-gsm-tester[master]: Move test.py and report.py to core/

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 4 18:45:58 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18033 )


Change subject: Move test.py and report.py to core/
......................................................................

Move test.py and report.py to core/

Change-Id: Ibb7fa5ab40bcf1e59705bdd2c2c5a76025b2b544
---
M selftest/suite_test.py
R src/osmo_gsm_tester/core/report.py
R src/osmo_gsm_tester/core/test.py
M src/osmo_gsm_tester/suite.py
M src/osmo_gsm_tester/testenv.py
M src/osmo_gsm_tester/trial.py
6 files changed, 20 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/33/18033/1

diff --git a/selftest/suite_test.py b/selftest/suite_test.py
index 1fb95ec..560ca50 100755
--- a/selftest/suite_test.py
+++ b/selftest/suite_test.py
@@ -2,9 +2,9 @@
 import os
 import _prep
 import shutil
-from osmo_gsm_tester.core import log, config, util
+from osmo_gsm_tester.core import log, config, util, report
 from osmo_gsm_tester.core.schema import generate_schemas
-from osmo_gsm_tester import suite, report
+from osmo_gsm_tester import suite
 
 config.ENV_CONF = './suite_test'
 
diff --git a/src/osmo_gsm_tester/report.py b/src/osmo_gsm_tester/core/report.py
similarity index 100%
rename from src/osmo_gsm_tester/report.py
rename to src/osmo_gsm_tester/core/report.py
diff --git a/src/osmo_gsm_tester/test.py b/src/osmo_gsm_tester/core/test.py
similarity index 94%
rename from src/osmo_gsm_tester/test.py
rename to src/osmo_gsm_tester/core/test.py
index ec81d7d..93dbf6a 100644
--- a/src/osmo_gsm_tester/test.py
+++ b/src/osmo_gsm_tester/core/test.py
@@ -21,9 +21,9 @@
 import sys
 import time
 import traceback
-from . import testenv
+from .. import testenv
 
-from .core import log, util, resource
+from . import log, util, resource
 
 class Test(log.Origin):
     UNKNOWN = 'UNKNOWN' # matches junit 'error'
@@ -56,11 +56,7 @@
             log.large_separator(self.suite_run.trial.name(), self.suite_run.name(), self.name(), sublevel=3)
             self.status = Test.UNKNOWN
             self.start_timestamp = time.time()
-            from .core import process
-            from .core.event_loop import MainLoop
-            from .obj import sms
-            from . import suite
-            testenv.setup(self.suite_run, self, suite, MainLoop, sms, process)
+            testenv.setup(self.suite_run, self)
             with self.redirect_stdout():
                 util.run_python_file('%s.%s' % (self.suite_run.definition.name(), self.basename),
                                      self.path)
diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index c5421c4..6952fd2 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -22,6 +22,7 @@
 import time
 import pprint
 from .core import config, log, util, process, schema, resource
+from .core import test
 from .core.event_loop import MainLoop
 from .obj import nitb_osmo, hlr_osmo, mgcpgw_osmo, mgw_osmo, msc_osmo, bsc_osmo, stp_osmo, ggsn_osmo, sgsn_osmo, esme, osmocon, ms_driver, iperf3
 from .obj import run_node
@@ -29,7 +30,6 @@
 from .obj import enb
 from .obj import bts
 from .obj import ms
-from . import test
 
 class Timeout(Exception):
     pass
diff --git a/src/osmo_gsm_tester/testenv.py b/src/osmo_gsm_tester/testenv.py
index ceea028..8c4743a 100644
--- a/src/osmo_gsm_tester/testenv.py
+++ b/src/osmo_gsm_tester/testenv.py
@@ -36,8 +36,14 @@
 Sms = None
 process = None
 
-def setup(suite_run, _test, suite_module, event_module, sms_module, process_module):
+def setup(suite_run, _test):
+    from .core import process as process_module
+    from .core.event_loop import MainLoop
+    from .obj.sms import Sms as Sms_class
+    from . import suite as suite_module
+
     global trial, suite, test, resources, log, dbg, err, wait, wait_no_raise, sleep, poll, prompt, Timeout, Sms, process
+
     trial = suite_run.trial
     suite = suite_run
     test = _test
@@ -45,13 +51,13 @@
     log = test.log
     dbg = test.dbg
     err = test.err
-    wait = lambda *args, **kwargs: event_module.wait(suite_run, *args, **kwargs)
-    wait_no_raise = lambda *args, **kwargs: event_module.wait_no_raise(suite_run, *args, **kwargs)
-    sleep = lambda *args, **kwargs: event_module.sleep(suite_run, *args, **kwargs)
-    poll = event_module.poll
+    wait = lambda *args, **kwargs: MainLoop.wait(suite_run, *args, **kwargs)
+    wait_no_raise = lambda *args, **kwargs: MainLoop.wait_no_raise(suite_run, *args, **kwargs)
+    sleep = lambda *args, **kwargs: MainLoop.sleep(suite_run, *args, **kwargs)
+    poll = MainLoop.poll
     prompt = suite_run.prompt
     Timeout = suite_module.Timeout
-    Sms = sms_module.Sms
+    Sms = Sms_class
     process = process_module
 
 # vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/osmo_gsm_tester/trial.py b/src/osmo_gsm_tester/trial.py
index 9dcc188..fb94a59 100644
--- a/src/osmo_gsm_tester/trial.py
+++ b/src/osmo_gsm_tester/trial.py
@@ -22,8 +22,8 @@
 import shutil
 import tarfile
 
-from .core import log, util
-from . import suite, report
+from .core import log, util, report
+from . import suite
 
 FILE_MARK_TAKEN = 'taken'
 FILE_CHECKSUMS = 'checksums.md5'

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18033
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: Ibb7fa5ab40bcf1e59705bdd2c2c5a76025b2b544
Gerrit-Change-Number: 18033
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200504/54c6a3d5/attachment.htm>


More information about the gerrit-log mailing list