Move test.py and report.py to core/
Change-Id: Ibb7fa5ab40bcf1e59705bdd2c2c5a76025b2b544
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'