当前位置: 首页>>代码示例>>Python>>正文


Python subunit.TestProtocolClient方法代码示例

本文整理汇总了Python中subunit.TestProtocolClient方法的典型用法代码示例。如果您正苦于以下问题:Python subunit.TestProtocolClient方法的具体用法?Python subunit.TestProtocolClient怎么用?Python subunit.TestProtocolClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在subunit的用法示例。


在下文中一共展示了subunit.TestProtocolClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def __init__(self, stream=sys.stdout, tbformat='default',
                 realtime=False, publisher=None):
        """
        Construct a L{SubunitReporter}.

        @param stream: A file-like object representing the stream to print
            output to. Defaults to stdout.
        @param tbformat: The format for tracebacks. Ignored, since subunit
            always uses Python's standard format.
        @param realtime: Whether or not to print exceptions in the middle
            of the test results. Ignored, since subunit always does this.
        @param publisher: The log publisher which will be preserved for
            reporting events. Ignored, as it's not relevant to subunit.
        """
        if TestProtocolClient is None:
            raise Exception("Subunit not available")
        self._subunit = TestProtocolClient(stream)
        self._successful = True 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:20,代码来源:reporter.py

示例2: run

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def run(self, test):
        "Run the given test case or test suite."
        result = TestProtocolClient(self.stream)
        result = AutoTimingTestResultDecorator(result)
        test(result)
        return result 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:8,代码来源:run.py

示例3: test_imports

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_imports(self):
        from subunit import DiscardStream
        from subunit import TestProtocolServer
        from subunit import RemotedTestCase
        from subunit import RemoteError
        from subunit import ExecTestCase
        from subunit import IsolatedTestCase
        from subunit import TestProtocolClient
        from subunit import ProtocolTestCase 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:11,代码来源:test_test_protocol.py

示例4: setUp

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def setUp(self):
        self.io = BytesIO()
        self.protocol = subunit.TestProtocolClient(self.io)
        self.test = TestTestProtocolClient("test_start_test")
        self.sample_details = {'something':Content(
            ContentType('text', 'plain'), lambda:[_b('serialised\nform')])}
        self.sample_tb_details = dict(self.sample_details)
        self.sample_tb_details['traceback'] = TracebackContent(
            subunit.RemoteError(_u("boo qux")), self.test) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:11,代码来源:test_test_protocol.py

示例5: test_start_test

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_start_test(self):
        """Test startTest on a TestProtocolClient."""
        self.protocol.startTest(self.test)
        self.assertEqual(self.io.getvalue(), _b("test: %s\n" % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:6,代码来源:test_test_protocol.py

示例6: test_add_success

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_success(self):
        """Test addSuccess on a TestProtocolClient."""
        self.protocol.addSuccess(self.test)
        self.assertEqual(
            self.io.getvalue(), _b("successful: %s\n" % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:7,代码来源:test_test_protocol.py

示例7: test_add_failure

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_failure(self):
        """Test addFailure on a TestProtocolClient."""
        self.protocol.addFailure(
            self.test, subunit.RemoteError(_u("boo qux")))
        self.assertEqual(
            self.io.getvalue(),
            _b(('failure: %s [\n' + _remote_exception_str + ': boo qux\n]\n')
            % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:10,代码来源:test_test_protocol.py

示例8: test_add_failure_details

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_failure_details(self):
        """Test addFailure on a TestProtocolClient with details."""
        self.protocol.addFailure(
            self.test, details=self.sample_tb_details)
        self.assertEqual(
            self.io.getvalue(),
            _b(("failure: %s [ multipart\n"
            "Content-Type: text/plain\n"
            "something\n"
            "F\r\nserialised\nform0\r\n"
            "Content-Type: text/x-traceback;charset=utf8,language=python\n"
            "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
            "]\n") % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:15,代码来源:test_test_protocol.py

示例9: test_add_error

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_error(self):
        """Test stopTest on a TestProtocolClient."""
        self.protocol.addError(
            self.test, subunit.RemoteError(_u("phwoar crikey")))
        self.assertEqual(
            self.io.getvalue(),
            _b(('error: %s [\n' +
            _remote_exception_str + ": phwoar crikey\n"
            "]\n") % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:11,代码来源:test_test_protocol.py

示例10: test_add_error_details

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_error_details(self):
        """Test stopTest on a TestProtocolClient with details."""
        self.protocol.addError(
            self.test, details=self.sample_tb_details)
        self.assertEqual(
            self.io.getvalue(),
            _b(("error: %s [ multipart\n"
            "Content-Type: text/plain\n"
            "something\n"
            "F\r\nserialised\nform0\r\n"
            "Content-Type: text/x-traceback;charset=utf8,language=python\n"
            "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
            "]\n") % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:15,代码来源:test_test_protocol.py

示例11: test_add_expected_failure

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_expected_failure(self):
        """Test addExpectedFailure on a TestProtocolClient."""
        self.protocol.addExpectedFailure(
            self.test, subunit.RemoteError(_u("phwoar crikey")))
        self.assertEqual(
            self.io.getvalue(),
            _b(('xfail: %s [\n' +
            _remote_exception_str + ": phwoar crikey\n"
            "]\n") % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:11,代码来源:test_test_protocol.py

示例12: test_add_skip

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_skip(self):
        """Test addSkip on a TestProtocolClient."""
        self.protocol.addSkip(
            self.test, "Has it really?")
        self.assertEqual(
            self.io.getvalue(),
            _b('skip: %s [\nHas it really?\n]\n' % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:9,代码来源:test_test_protocol.py

示例13: test_add_skip_details

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_skip_details(self):
        """Test addSkip on a TestProtocolClient with details."""
        details = {'reason':Content(
            ContentType('text', 'plain'), lambda:[_b('Has it really?')])}
        self.protocol.addSkip(self.test, details=details)
        self.assertEqual(
            self.io.getvalue(),
            _b("skip: %s [ multipart\n"
            "Content-Type: text/plain\n"
            "reason\n"
            "E\r\nHas it really?0\r\n"
            "]\n" % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:14,代码来源:test_test_protocol.py

示例14: test_add_unexpected_success

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_unexpected_success(self):
        """Test addUnexpectedSuccess on a TestProtocolClient."""
        self.protocol.addUnexpectedSuccess(self.test)
        self.assertEqual(
            self.io.getvalue(), _b("uxsuccess: %s\n" % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:7,代码来源:test_test_protocol.py

示例15: test_add_unexpected_success_details

# 需要导入模块: import subunit [as 别名]
# 或者: from subunit import TestProtocolClient [as 别名]
def test_add_unexpected_success_details(self):
        """Test addUnexpectedSuccess on a TestProtocolClient with details."""
        self.protocol.addUnexpectedSuccess(self.test, details=self.sample_details)
        self.assertEqual(
            self.io.getvalue(), _b("uxsuccess: %s [ multipart\n"
                "Content-Type: text/plain\n"
                "something\n"
                "F\r\nserialised\nform0\r\n]\n" % self.test.id())) 
开发者ID:byt3bl33d3r,项目名称:pth-toolkit,代码行数:10,代码来源:test_test_protocol.py


注:本文中的subunit.TestProtocolClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。