Ejemplo n.º 1
0
def report_suite_parse_error(ex: SuiteParseError,
                             stdout_printer: FilePrinter,
                             stderr_printer: FilePrinter,
                             ) -> int:
    exit_value = ex.document_parser_exception.accept(_GetParseErrorExitValue())
    stdout_printer.write_colored_line(exit_value.exit_identifier, exit_value.color)
    stdout_printer.file.flush()

    blocks_renderer = _suite_parse_error_renderer(ex)
    reporting.print_major_blocks(blocks_renderer,
                                 stderr_printer)

    return exit_value.exit_code
Ejemplo n.º 2
0
def _print_to_str(printable: Printable) -> str:
    output_file = io.StringIO()
    printer = Printer.new(FilePrinter(output_file))

    printable.print_on(printer)

    return output_file.getvalue()
Ejemplo n.º 3
0
 def __init__(self,
              root_suite: structure.TestSuiteHierarchy,
              std_output_files: StdOutputFiles,
              root_suite_dir_abs_path: pathlib.Path):
     self._root_suite = root_suite
     self._std_output_files = std_output_files
     self._output_file = FilePrinter(std_output_files.out)
     self._error_file = file_printer.file_printer_with_color_if_terminal(std_output_files.err)
     self._sub_reporters = []
     self._start_time = None
     self._total_time_timedelta = None
     self._root_suite_dir_abs_path = root_suite_dir_abs_path
     self._host_name = platform.node()
Ejemplo n.º 4
0
def error_message_for_error_info(error_info: ErrorInfo) -> str:
    output_file = io.StringIO()
    print_error_info(FilePrinter(output_file), error_info)
    return output_file.getvalue()
Ejemplo n.º 5
0
def error_message_for_full_result(the_full_result: FullExeResult) -> str:
    output_file = io.StringIO()
    print_error_message_for_full_result(FilePrinter(output_file), the_full_result)
    return output_file.getvalue()
Ejemplo n.º 6
0
def _output_exit_value(printer: FilePrinter, exit_value: ExitValue):
    printer.write_colored_line(exit_value.exit_identifier, exit_value.color)
    printer.flush()