html_reporter.result

This module contains the HTMLTEstRunner class.

Module Contents

Classes

TestCaseResult

A dataclass representing a test case result.

HTMLTestResult

HTMLTestResult is a pure representation of results.

Attributes

stdout_redirector

stderr_redirector

html_reporter.result.stdout_redirector[source]
html_reporter.result.stderr_redirector[source]
class html_reporter.result.TestCaseResult[source]

A dataclass representing a test case result.

Parameters
  • status (TestStatus) – the test case status

  • test_case (unittest.TestCase) – the test case object

  • output (str) – the test case output

  • error (str) – the test case error

status :html_reporter.status.TestStatus[source]
test_case :unittest.TestCase[source]
output :str[source]
error :str[source]
class html_reporter.result.HTMLTestResult(descriptions=None, verbosity: int = 1)[source]

Bases: unittest.TestResult

HTMLTestResult is a pure representation of results. It lacks the output and reporting ability compares to unittest.TextTestResult.

Constructor.

Parameters
  • descriptions (optional) – descriptions, defaults to None

  • verbosity (int, optional) – verbosity, defaults to 1

get_description(test)[source]
startTest(test)[source]

Called when the given test is about to be run.

complete_output()[source]

Disconnect output redirection and return buffer. Safe to call multiple times.

stopTest(test)[source]

Called when the given test has been run.

addSuccess(test)[source]

Called when a test has completed successfully.

addError(test, err)[source]

Called when an error has occurred. ‘err’ is a tuple of values as returned by sys.exc_info().

addFailure(test, err)[source]

Called when an error has occurred. ‘err’ is a tuple of values as returned by sys.exc_info().

addSkip(test, reason)[source]

Called when a test is skipped.

total_count()[source]