robot.output.console package

robot.output.console.ConsoleOutput(console: Literal['VERBOSE', 'DOTTED', 'QUIET', 'NONE'] | object = 'VERBOSE', width: int = 78, colors: Literal['AUTO', 'ON', 'OFF', 'ANSI'] = 'AUTO', links: Literal['AUTO', 'OFF'] = 'AUTO', markers: Literal['AUTO', 'ON', 'OFF'] = 'AUTO', stdout: TextIOBase | None = None, stderr: TextIOBase | None = None)[source]

Submodules

robot.output.console.base module

class robot.output.console.base.BaseConsole(width: int = 78, colors: Literal['AUTO', 'ON', 'OFF', 'ANSI'] = 'AUTO', links: Literal['AUTO', 'OFF'] = 'AUTO', stdout: TextIOBase | None = None, stderr: TextIOBase | None = None)[source]

Bases: object

Base class for built-in console loggers that also external loggers can use.

Writes warnings and errors to the stderr and result file paths to the stdout by default. That can be changed by overriding relevant methods. More functionality can be added by implementing needed listener interface methods.

Public methods and attributes are part of the stable API and can be used by extending classes. Anything private (i.e. starting with an underscore) may change between releases.

Supports all the same hook methods that the listener API supports.

New in Robot Framework 7.5.

message(msg: Message)[source]

Hook method to handle warnings and errors.

output_file(path: Path | None)[source]

Hook method to handle output files.

Called when the output file is finished, even if the output file would be disabled. Calls result_file() by default.

result_file(kind: ResultFile, path: Path | None)[source]

Hook method to handle other result files than the output file.

Called when result files are finished unless they are disabled.

write(text: str, stderr: bool = False, flush: bool = True)[source]

Write given text to stdout or stderr.

Parameters:
  • text – Text to write to stdout/stderr.

  • stderr – When true, write to stderr instead of stdout.

  • flush – When true, stream is flushed after writing to it.

highlight(status: Literal['PASS', 'FAIL', 'SKIP', 'ERROR', 'WARN'], text: str | None = None, stderr: bool = False, flush: bool = True)[source]

Highlight given status or text.

Parameters:
  • status – Status marker.

  • text – Text to highlight. If not given, highlights the status text.

  • stderr – When true, write to stderr instead of stdout.

  • flush – When true, stream is flushed after writing to it.

Console link given path.

If console does not support linking, write path as-is. Write “NONE” if path is None.

clear()[source]

Clear the current line in stdout.

robot.output.console.dotted module

class robot.output.console.dotted.DottedConsole(width: int = 78, colors: Literal['AUTO', 'ON', 'OFF', 'ANSI'] = 'AUTO', links: Literal['AUTO', 'OFF'] = 'AUTO', stdout: TextIOBase | None = None, stderr: TextIOBase | None = None)[source]

Bases: BaseConsole

Dotted console logger.

Reports each test with “.” (PASS), “F” (FAIL) or “s” (SKIP).

start_suite(data: running.TestSuite, result: result.TestSuite)[source]
end_test(data: running.TestCase, result: result.TestCase)[source]
end_suite(data: running.TestSuite, result: result.TestSuite)[source]
report_failures(suite: result.TestSuite)[source]

Reports failed tests.

report_status(suite: result.TestSuite)[source]

Reports overall status.

robot.output.console.highlighting module

class robot.output.console.highlighting.HighlightingStream(stream: TextIOBase | None, colors: Literal['AUTO', 'ON', 'OFF', 'ANSI'] = 'AUTO', links: Literal['AUTO', 'OFF'] = 'AUTO')[source]

Bases: object

write(text: str, flush: bool = True)[source]
flush()[source]
highlight(status: Literal['PASS', 'FAIL', 'SKIP', 'ERROR', 'WARN'], text: str | None = None, flush: bool = True)[source]
error(message: str, level: Literal['ERROR', 'WARN'])[source]
class robot.output.console.highlighting.NullStream[source]

Bases: TextIOBase

write(text)[source]

Write string s to stream.

Return the number of characters written (which is always equal to the length of the string).

flush()[source]

Flush write buffers, if applicable.

This is not implemented for read-only and non-blocking streams.

class robot.output.console.highlighting.Highlighter[source]

Bases: ABC

classmethod from_config(stream: TextIOBase | None, colors: Literal['AUTO', 'ON', 'OFF', 'ANSI'] = 'AUTO', links: Literal['AUTO', 'OFF'] = 'AUTO') → Highlighter[source]
green()[source]
red()[source]
yellow()[source]
reset()[source]
class robot.output.console.highlighting.NoHighlighting[source]

Bases: Highlighter

class robot.output.console.highlighting.AnsiHighlighter(stream: TextIOBase, links: bool = True)[source]

Bases: Highlighter

GREEN = '\x1b[32m'
RED = '\x1b[31m'
YELLOW = '\x1b[33m'
RESET = '\x1b[0m'
green()[source]
red()[source]
yellow()[source]
reset()[source]
class robot.output.console.highlighting.DosHighlighter(stream: TextIOBase)[source]

Bases: Highlighter

FOREGROUND_GREEN = 2
FOREGROUND_RED = 4
FOREGROUND_YELLOW = 6
FOREGROUND_GREY = 7
FOREGROUND_INTENSITY = 8
BACKGROUND_MASK = 240
green()[source]
red()[source]
yellow()[source]
reset()[source]
robot.output.console.highlighting.get_std_handle(stream: TextIOBase)[source]
robot.output.console.highlighting.virtual_terminal_enabled(stream)[source]

robot.output.console.quiet module

class robot.output.console.quiet.QuietConsole(colors: Literal['AUTO', 'ON', 'OFF', 'ANSI'] = 'AUTO', stderr: TextIOBase | None = None)[source]

Bases: BaseConsole

Quiet console logger.

Only reports warnings and errors.

result_file(kind: Literal['OUTPUT', 'REPORT', 'LOG', 'XUNIT', 'DEBUG'], path: Path)[source]

Hook method to handle other result files than the output file.

Called when result files are finished unless they are disabled.

class robot.output.console.quiet.NoneConsole[source]

Bases: BaseConsole

Totally quiet console logger.

Does not report anything, not even warnings or errors.

message(msg: Message)[source]

Hook method to handle warnings and errors.

result_file(kind: Literal['OUTPUT', 'REPORT', 'LOG', 'XUNIT', 'DEBUG'], path: Path)[source]

Hook method to handle other result files than the output file.

Called when result files are finished unless they are disabled.

robot.output.console.types module

robot.output.console.verbose module

class robot.output.console.verbose.VerboseConsole(width: int = 78, colors: Literal['AUTO', 'ON', 'OFF', 'ANSI'] = 'AUTO', links: Literal['AUTO', 'OFF'] = 'AUTO', markers: Literal['AUTO', 'ON', 'OFF'] = 'AUTO', stdout: TextIOBase | None = None, stderr: TextIOBase | None = None)[source]

Bases: BaseConsole

Verbose console logger.

Reports started suites and tests separately.

status_length = 8
start_suite(data: running.TestSuite, result: result.TestSuite)[source]
end_suite(data: running.TestSuite, result: result.TestSuite)[source]
start_test(data: running.TestCase, result: result.TestCase)[source]
end_test(data: running.TestCase, result: result.TestCase)[source]
start_body_item(data, result)[source]
end_body_item(data, result)[source]
message(msg: output.Message)[source]

Hook method to handle warnings and errors.

suite_separator()[source]

Write suite separator.

test_separator()[source]

Write test separator.

info(name: str, doc: str, start_suite: bool = False)[source]

Write info about started or ended suite or test.

status(status: Literal['PASS', 'FAIL', 'SKIP', 'ERROR', 'WARN'], message: str)[source]

Write status information.

marker(status: str)[source]

Write marker when a top level keyword is started.