mirror of
https://git.yoctoproject.org/git/poky
synced 2026-01-01 13:58:04 +00:00
oeqa/utils/decorators: Try and improve ugly _ErrorHandler tracebacks
Currently, if one module is skipped, any other module calling skipModule causes tracebacks about _ErrorHandler not having a _testMethodName method. This reworks the code in a way to avoid some of the problems by using the id() method of the objects. It also maps to the correct name format rather than "setupModule" or just skiping the item entirely. (From OE-Core rev: 78d3bf2e4c88779df32b9dfbe8362dc24e9ad080) (From OE-Core rev: 4019ae1dc223a5ec925e49fb9c3ad33ce170cbab) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
2f598a8318
commit
f30d619a63
|
|
@ -18,14 +18,21 @@ class getResults(object):
|
|||
upperf = sys._current_frames().values()[0]
|
||||
while (upperf.f_globals['__name__'] != 'unittest.case'):
|
||||
upperf = upperf.f_back
|
||||
self.faillist = [ seq[0]._testMethodName for seq in upperf.f_locals['result'].failures ]
|
||||
self.errorlist = [ seq[0]._testMethodName for seq in upperf.f_locals['result'].errors ]
|
||||
#ignore the _ErrorHolder objects from the skipped tests list
|
||||
self.skiplist = []
|
||||
for seq in upperf.f_locals['result'].skipped:
|
||||
try:
|
||||
self.skiplist.append(seq[0]._testMethodName)
|
||||
except: pass
|
||||
|
||||
def handleList(items):
|
||||
ret = []
|
||||
# items is a list of tuples, (test, failure) or (_ErrorHandler(), Exception())
|
||||
for i in items:
|
||||
s = i[0].id()
|
||||
#Handle the _ErrorHolder objects from skipModule failures
|
||||
if "setUpModule (" in s:
|
||||
ret.append(s.replace("setUpModule (", "").replace(")",""))
|
||||
else:
|
||||
ret.append(s)
|
||||
return ret
|
||||
self.faillist = handleList(upperf.f_locals['result'].failures)
|
||||
self.errorlist = handleList(upperf.f_locals['result'].errors)
|
||||
self.skiplist = handleList(upperf.f_locals['result'].skipped)
|
||||
|
||||
def getFailList(self):
|
||||
return self.faillist
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user