# The Output Module

This module provides functions for dealing with any output from stestr. This mostly just means helper functions to properly write output to stdout (or another file) Any function or class in this module that has a docstring is a stable interface and should be backwards compatible.

class `stestr.output.``ReturnCodeToSubunit`(process)

  Converts a process return code to a subunit error on the process stdout.

  The ReturnCodeToSubunit object behaves as a read-only stream, supplying the read, readline and readlines methods. If the process exits non-zero a synthetic test is added to the output, making the error accessible to subunit stream consumers. If the process closes its stdout and then does not terminate, reading from the ReturnCodeToSubunit stream will hang.

  Parameters: | process – A subprocess.Popen object that is generating subunit.

`stestr.output.``output_summary`(successful, tests, tests_delta, time, time_delta, values, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)

  Display a summary view for the test run.

  Parameters:

  - successful (bool) – Was the test run successful
  - tests (int) – The number of tests that ran
  - tests_delta (int) – The change in the number of tests that ran since the last run
  - time (float) – The number of seconds that it took for the run to execute
  - time_delta (float) – The change in run time since the last run
  - values – A list of sets that are used for a breakdown of statuses other than success. Each set is in the format: (status, number of tests, change in number of tests).
  - output – The output file object to use. This defaults to stdout

`stestr.output.``output_table`(table, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)

  Display a table of information.

  Parameters:

  - table – A list of sets representing each row in the table. Each element in the set represents a column in the table.
  - output – The output file object to write the table to. By default this is sys.stdout

`stestr.output.``output_tests`(tests, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)

  Display a list of tests.

  Parameters:

  - tests – A list of test objects to output
  - output – The output file object to write the list to. By default this is sys.stdout