test_xml_handler.py 文件源码

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

项目:rotest 作者: gregoil 项目源码 文件源码
def validate_result(self, test, result, traceback=""):
        """Validate adding result gives the expected output.

        Args:
            test (rotest.core.case.TestCase): the test its result was added.
            result (str): result to add to the test.
            traceback (str): the traceback of the test.

        Raises:
            AssertionError. the result wasn't added as expected.
        """
        if isinstance(test, TestBlock):
            return

        result_xml_file = os.path.join(test.work_dir,
                                       XMLHandler.XML_REPORT_PATH)

        expected_xml_file = self.expected_xml_files.next()

        expected_xml = xmltodict.parse(open(expected_xml_file, "rt").read(),
                                       dict_constructor=dict)
        result_xml = xmltodict.parse(open(result_xml_file, "rt").read(),
                                     dict_constructor=dict)

        self.assertEqual(expected_xml, result_xml)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号