本文整理汇总了Python中moztest.results.TestResultCollection.append方法的典型用法代码示例。如果您正苦于以下问题:Python TestResultCollection.append方法的具体用法?Python TestResultCollection.append怎么用?Python TestResultCollection.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moztest.results.TestResultCollection
的用法示例。
在下文中一共展示了TestResultCollection.append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_to_autolog
# 需要导入模块: from moztest.results import TestResultCollection [as 别名]
# 或者: from moztest.results.TestResultCollection import append [as 别名]
def post_to_autolog(self, results, name):
from moztest.results import TestContext, TestResult, TestResultCollection
from moztest.output.autolog import AutologOutput
context = TestContext(
testgroup='b2g xpcshell testsuite',
operating_system='android',
arch='emulator',
harness='xpcshell',
hostname=socket.gethostname(),
tree='b2g',
buildtype='opt',
)
collection = TestResultCollection('b2g emulator testsuite')
for result in results:
duration = result.get('time', 0)
if 'skipped' in result:
outcome = 'SKIPPED'
elif 'todo' in result:
outcome = 'KNOWN-FAIL'
elif result['passed']:
outcome = 'PASS'
else:
outcome = 'UNEXPECTED-FAIL'
output = None
if 'failure' in result:
output = result['failure']['text']
t = TestResult(name=result['name'], test_class=name,
time_start=0, context=context)
t.finish(result=outcome, time_end=duration, output=output)
collection.append(t)
collection.time_taken += duration
out = AutologOutput()
out.post(out.make_testgroups(collection))