當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。