propagate Timeout class to test scope, use in debug suite

Change-Id: Idad34fe799bc8b8e03d773898473773656b005bd
This commit is contained in:
Neels Hofmeyr 2017-05-07 02:15:48 +02:00
parent 0dd718eeac
commit 28a34dd306
3 changed files with 9 additions and 4 deletions

View File

@ -93,7 +93,7 @@ class Test(log.Origin):
def run(self, suite_run):
assert self.suite is suite_run.definition
with self:
test.setup(suite_run, self, ofono_client)
test.setup(suite_run, self, ofono_client, sys.modules[__name__])
success = False
try:
self.log('START')

View File

@ -31,9 +31,10 @@ wait = None
sleep = None
poll = None
prompt = None
Timeout = None
def setup(suite_run, _test, ofono_client):
global trial, suite, test, resources, log, dbg, err, wait, sleep, poll, prompt
def setup(suite_run, _test, ofono_client, suite_module):
global trial, suite, test, resources, log, dbg, err, wait, sleep, poll, prompt, Timeout
trial = suite_run.trial
suite = suite_run
test = _test
@ -45,5 +46,6 @@ def setup(suite_run, _test, ofono_client):
sleep = suite_run.sleep
poll = suite_run.poll
prompt = suite_run.prompt
Timeout = suite_module.Timeout
# vim: expandtab tabstop=4 shiftwidth=4

View File

@ -24,7 +24,10 @@ while True:
if 'Quit'.startswith(cmd):
break
elif 'wait-registered'.startswith(cmd):
wait(nitb.subscriber_attached, *modems)
try:
wait(nitb.subscriber_attached, *modems)
except Timeout:
print('Timeout while waiting for registration.')
elif 'query-registered'.startswith(cmd):
print(nitb.imsi_list_attached())
print('QUERY RESULT: %s' %