diff --git a/selftest/suite_test.py b/selftest/suite_test.py index 1fb95ec1..560ca507 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 ec81d7d5..93dbf6a5 100644 --- a/src/osmo_gsm_tester/test.py +++ b/src/osmo_gsm_tester/core/test.py @@ -21,9 +21,9 @@ import os 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 @@ class Test(log.Origin): 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 c5421c45..6952fd27 100644 --- a/src/osmo_gsm_tester/suite.py +++ b/src/osmo_gsm_tester/suite.py @@ -22,6 +22,7 @@ import sys 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 epc 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 ceea028b..8c4743af 100644 --- a/src/osmo_gsm_tester/testenv.py +++ b/src/osmo_gsm_tester/testenv.py @@ -36,8 +36,14 @@ Timeout = None 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 @@ def setup(suite_run, _test, suite_module, event_module, sms_module, process_modu 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 9dcc1880..fb94a59b 100644 --- a/src/osmo_gsm_tester/trial.py +++ b/src/osmo_gsm_tester/trial.py @@ -22,8 +22,8 @@ import time 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'