зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1338534 - [mozlog] Log message and stack for failures when using pytest-mozlog with pytest-xdist. r=ahal
When using pytest-xdist to run tests in parallel, failures are serialised as strings. This means we're unable to reliably extract the message and line number, so instead we log the stack and the message as the serialised string result. MozReview-Commit-ID: 6vrEjBtkXK8 --HG-- extra : rebase_source : f337653f90cbbe6b1972b7d1e5e1a222c0a4604f
This commit is contained in:
Родитель
405bdcdb4d
Коммит
34adf4a9b2
|
@ -84,9 +84,13 @@ class MozLog(object):
|
|||
status = 'FAIL'
|
||||
elif report.failed:
|
||||
status = 'FAIL' if report.when == 'call' else 'ERROR'
|
||||
crash = report.longrepr.reprcrash # here longrepr is a ReprExceptionInfo
|
||||
message = "{0} (line {1})".format(crash.message, crash.lineno)
|
||||
stack = report.longrepr.reprtraceback
|
||||
try:
|
||||
crash = report.longrepr.reprcrash # here longrepr is a ReprExceptionInfo
|
||||
message = "{0} (line {1})".format(crash.message, crash.lineno)
|
||||
stack = report.longrepr.reprtraceback
|
||||
except AttributeError:
|
||||
# When using pytest-xdist, longrepr is serialised as a str
|
||||
message = stack = report.longrepr
|
||||
elif report.skipped: # indicates true skip
|
||||
status = expected = 'SKIP'
|
||||
message = report.longrepr[-1] # here longrepr is a tuple (file, lineno, reason)
|
||||
|
|
Загрузка…
Ссылка в новой задаче