MCPcopy
hub / github.com/pytest-dev/pytest / create_terminal_writer

Function create_terminal_writer

src/_pytest/config/__init__.py:2079–2100  ·  view source on GitHub ↗

Create a TerminalWriter instance configured according to the options in the config object. Every code which requires a TerminalWriter object and has access to a config object should use this function.

(
    config: Config, file: TextIO | None = None
)

Source from the content-addressed store, hash-verified

2077
2078
2079def create_terminal_writer(
2080 config: Config, file: TextIO | None = None
2081) -> TerminalWriter:
2082 """Create a TerminalWriter instance configured according to the options
2083 in the config object.
2084
2085 Every code which requires a TerminalWriter object and has access to a
2086 config object should use this function.
2087 """
2088 tw = TerminalWriter(file=file)
2089
2090 if config.option.color == "yes":
2091 tw.hasmarkup = True
2092 elif config.option.color == "no":
2093 tw.hasmarkup = False
2094
2095 if config.option.code_highlight == "yes":
2096 tw.code_highlight = True
2097 elif config.option.code_highlight == "no":
2098 tw.code_highlight = False
2099
2100 return tw
2101
2102
2103def _strtobool(val: str) -> bool:

Callers 2

pytest_terminal_summaryFunction · 0.90
_create_formatterMethod · 0.90

Calls 1

TerminalWriterClass · 0.90

Tested by

no test coverage detected