本文整理汇总了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
示例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
示例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
示例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)
示例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()))
示例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()))
示例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()))
示例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()))
示例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()))
示例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()))
示例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()))
示例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()))
示例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()))
示例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()))
示例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()))