test_test_protocol.py 文件源码

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

项目:deb-subunit 作者: openstack 项目源码 文件源码
def test_story(self):
        client = unittest.TestResult()
        protocol = subunit.TestProtocolServer(client)
        traceback = "foo.c:53:ERROR invalid state\n"
        pipe = BytesIO(_b("test old mcdonald\n"
                        "success old mcdonald\n"
                        "test bing crosby\n"
                        "failure bing crosby [\n"
                        +  traceback +
                        "]\n"
                        "test an error\n"
                        "error an error\n"))
        protocol.readFrom(pipe)
        bing = subunit.RemotedTestCase("bing crosby")
        an_error = subunit.RemotedTestCase("an error")
        self.assertEqual(
            client.errors,
            [(an_error, tb_prelude + _remote_exception_repr + '\n')])
        self.assertEqual(
            client.failures,
            [(bing, tb_prelude + _remote_exception_repr + ": "
              + details_to_str({'traceback': text_content(traceback)}) + "\n")])
        self.assertEqual(client.testsRun, 3)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号