From 604403dca638238a92e9c7eb2801b0642b8067ab Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Wed, 21 May 2014 09:59:14 +0530 Subject: [PATCH 01/28] Add skip test functionality - Now it shows skipped test also in html. --- HTMLTestRunner.py | 211 +++++++++++++++++++++++++--------------------- 1 file changed, 116 insertions(+), 95 deletions(-) diff --git a/HTMLTestRunner.py b/HTMLTestRunner.py index 8d60600..4860bed 100644 --- a/HTMLTestRunner.py +++ b/HTMLTestRunner.py @@ -112,6 +112,7 @@ # >>> logging.basicConfig(stream=HTMLTestRunner.stdout_redirector) # >>> + def to_unicode(s): try: return unicode(s) @@ -119,8 +120,11 @@ def to_unicode(s): # s is non ascii byte string return s.decode('unicode_escape') + class OutputRedirector(object): + """ Wrapper to redirect stdout or stderr """ + def __init__(self, fp): self.fp = fp @@ -138,11 +142,10 @@ def flush(self): stderr_redirector = OutputRedirector(sys.stderr) - # ---------------------------------------------------------------------- # Template - class Template_mixin(object): + """ Define a HTML template for report customerization and generation. @@ -183,9 +186,10 @@ class Template_mixin(object): """ STATUS = { - 0: 'pass', - 1: 'fail', - 2: 'error', + 0: 'pass', + 1: 'fail', + 2: 'error', + 3: 'skip', } DEFAULT_TITLE = 'Unit Test Report' @@ -207,7 +211,7 @@ class Template_mixin(object): -
-

Unit Test Report

-

Start Time: 2015-11-01 20:47:12

-

Duration: 0:00:00.001000

-

Status: Pass 1, Skip 3, Failure 1, Error 1

-

+
+

Unit Test Report

+ +

Start Time: 2015-11-02 13:24:10

+

Duration: 0:00:00.001000

+

Status: Pass 1, Skip 3, Failure 1, Error 1

+

Show @@ -276,7 +280,7 @@

Unit Test Report

ERROR