ui.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:pytest-ui 作者: martinsmid 项目源码 文件源码
def set_test_result(self, test_id, result_state, output, when, outcome,
                        exc_type=None, exc_value=None, extracted_traceback=None, last_failed_exempt=None):
        if not test_id in self.test_data:
            self.test_data[test_id] = {
                'id': test_id
            }

        if extracted_traceback:
            output += ''.join(
                traceback.format_list(extracted_traceback) +
                [exc_value]
            )

        test_data = self.test_data[test_id]
        test_data['exc_type'] = exc_type
        test_data['exc_value'] = exc_value
        test_data['exc_tb'] = extracted_traceback
        if when == 'call' and last_failed_exempt is not None:
            test_data['last_failed_exempt'] = last_failed_exempt

        # Ignore success, except for the 'call' step
        # ignore successive failure, take only the first
        if (outcome != 'passed' or when == 'call') \
            and not test_data.get('result_state'):
            test_data['result_state'] = result_state
            test_data['output'] = output
            self.ui.update_test_result(test_data)

        if when == 'teardown':
            test_data['runstate'] = None
            self.ui.update_test_line(test_data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号