launch_testing.tools.output module

launch_testing.tools.output.basic_output_filter(filtered_prefixes=None, filtered_patterns=None)

Create a line filtering function to help output testing.

Parameters:

filtered_prefixes – A list of byte strings representing prefixes that will cause

output lines to be ignored if they start with one of the prefixes. By default lines starting with the process ID (‘pid’) and return code (‘rc’) will be ignored. :param filtered_patterns: A list of byte strings representing regexes that will cause output lines to be ignored if they match one of the regexes.

launch_testing.tools.output.expect_output(text=None, *, lines=None, expected_text=None, expected_lines=None, strip_ansi_escape_sequences=True, strict=False)

Match output text or lines with expected text or lines.

Either (expected) text or (expected) lines can be provided but giving both results in a ValueError. If lines are given but a text is expected, these lines are joined using ‘n’. Likewise, if text is given but lines are expected, text is split into lines.

Parameters:
  • expected_text – output text expectation, as supported by launch_testing.tools.text.build_text_match

  • expected_lines – output lines expectation, as supported by launch_testing.tools.text.build_line_match

  • text – output text to be matched

  • lines – output text lines to be matched

  • strip_ansi_escape_sequences – If True (default), strip ansi escape sequences from actual output before comparing

launch_testing.tools.output.expected_output_from_file(path)

Get expected output lines from a file.

Parameters:

path – path w/o extension of either a .txt file containing the lines

to be matched or a .regex file containing patterns to be searched for.

launch_testing.tools.output.get_default_filtered_patterns()
launch_testing.tools.output.get_default_filtered_prefixes()