當前位置: 首頁>>代碼示例>>Python>>正文


Python HTMLTestRunner.stdout_redirector方法代碼示例

本文整理匯總了Python中HTMLTestRunner.stdout_redirector方法的典型用法代碼示例。如果您正苦於以下問題:Python HTMLTestRunner.stdout_redirector方法的具體用法?Python HTMLTestRunner.stdout_redirector怎麽用?Python HTMLTestRunner.stdout_redirector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HTMLTestRunner的用法示例。


在下文中一共展示了HTMLTestRunner.stdout_redirector方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: startTest

# 需要導入模塊: import HTMLTestRunner [as 別名]
# 或者: from HTMLTestRunner import stdout_redirector [as 別名]
def startTest(self, test):
        testMethod = getattr(test, test._testMethodName)
        if not (getattr(test.__class__, "__unittest_skip__", False) or
                getattr(testMethod, "__unittest_skip__", False)):
            logging.info('******************************')
            logging.info(test.id().split('.')[-1])
            logging.info('******************************')
        TestResult.startTest(self, test)
        # just one buffer for both stdout and stderr
        self.outputBuffer = StringIO.StringIO()
        stdout_redirector.testStarted = True
        stdout_redirector.fp = self.outputBuffer
        stderr_redirector.fp = self.outputBuffer
        self.stdout0 = sys.stdout
        self.stderr0 = sys.stderr
        sys.stdout = stdout_redirector
        sys.stderr = stderr_redirector
        if xunitReport:
            self.xunit.beforeTest(test) 
開發者ID:kamwar,項目名稱:simLAB,代碼行數:21,代碼來源:html_test_runner.py

示例2: complete_output

# 需要導入模塊: import HTMLTestRunner [as 別名]
# 或者: from HTMLTestRunner import stdout_redirector [as 別名]
def complete_output(self):
        """
        Disconnect output redirection and return buffer.
        Safe to call multiple times.
        """
        if self.stdout0:
            sys.stdout = self.stdout0
            sys.stderr = self.stderr0
            self.stdout0 = None
            self.stderr0 = None
            stdout_redirector.testStarted = False
        try:
            output = self.outputBuffer.getvalue()
        except:
            # failed when outputBuffer hasn't been created
            # e.g error is reported in SetUpClass and startTest hasn't been called yet
            output = ""
        return output 
開發者ID:kamwar,項目名稱:simLAB,代碼行數:20,代碼來源:html_test_runner.py

示例3: startTest

# 需要導入模塊: import HTMLTestRunner [as 別名]
# 或者: from HTMLTestRunner import stdout_redirector [as 別名]
def startTest(self, test):
        TestResult.startTest(self, test)
        # just one buffer for both stdout and stderr
        self.outputBuffer = io.StringIO()
        stdout_redirector.fp = self.outputBuffer
        stderr_redirector.fp = self.outputBuffer
        self.stdout0 = sys.stdout
        self.stderr0 = sys.stderr
        sys.stdout = stdout_redirector
        sys.stderr = stderr_redirector 
開發者ID:huilansame,項目名稱:Test_framework,代碼行數:12,代碼來源:HTMLTestRunner.py

示例4: startTest

# 需要導入模塊: import HTMLTestRunner [as 別名]
# 或者: from HTMLTestRunner import stdout_redirector [as 別名]
def startTest(self, test):
        TestResult.startTest(self, test)
        # just one buffer for both stdout and stderr
        self.outputBuffer = StringIO.StringIO()
        stdout_redirector.fp = self.outputBuffer
        stderr_redirector.fp = self.outputBuffer
        self.stdout0 = sys.stdout
        self.stderr0 = sys.stderr
        sys.stdout = stdout_redirector
        sys.stderr = stderr_redirector 
開發者ID:mikhailadvani,項目名稱:aws-security-test,代碼行數:12,代碼來源:HTMLTestRunner.py


注:本文中的HTMLTestRunner.stdout_redirector方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。