test.py: fix bug in direct call feature

This commit is contained in:
The MMGen Project 2021-06-27 20:57:59 +00:00
commit c5f3745550
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -783,10 +783,8 @@ class TestSuiteRunner(object):
else:
if ':' in arg:
gname,arg = arg.split(':')
direct_call_ok = True # allow calling of functions not in cmd_group
else:
gname = self.gm.find_cmd_in_groups(arg)
direct_call_ok = False
if gname:
same_grp = gname == gname_save # same group as previous cmd: don't clean, suppress blue msg
if not self.init_group(gname,arg,quiet=same_grp):
@ -795,8 +793,8 @@ class TestSuiteRunner(object):
clean(self.ts.tmpdir_nums)
try:
self.check_needs_rerun(arg,build=True)
except:
if direct_call_ok:
except Exception as e: # allow calling of functions not in cmd_group
if isinstance(e,KeyError) and e.args[0] == arg:
ret = getattr(self.ts,arg)()
if type(ret).__name__ == 'coroutine':
run_session(ret)