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

Method __init__

src/_pytest/terminal.py:380–408  ·  view source on GitHub ↗
(self, config: Config, file: TextIO | None = None)

Source from the content-addressed store, hash-verified

378@final
379class TerminalReporter:
380 def __init__(self, config: Config, file: TextIO | None = None) -> None:
381 import _pytest.config
382
383 self.config = config
384 self._numcollected = 0
385 self._session: Session | None = None
386 self._showfspath: bool | None = None
387
388 self.stats: dict[str, list[Any]] = {}
389 self._main_color: str | None = None
390 self._known_types: list[str] | None = None
391 self.startpath = config.invocation_params.dir
392 if file is None:
393 file = sys.stdout
394 self._tw = _pytest.config.create_terminal_writer(config, file)
395 self._screen_width = self._tw.fullwidth
396 self.currentfspath: None | Path | str | int = None
397 self.reportchars = getreportopt(config)
398 self.foldskipped = config.option.fold_skipped
399 self.hasmarkup = self._tw.hasmarkup
400 # isatty should be a method but was wrongly implemented as a boolean.
401 # We use CallableBool here to support both.
402 self.isatty = compat.CallableBool(file.isatty())
403 self._progress_nodeids_reported: set[str] = set()
404 self._timing_nodeids_reported: set[str] = set()
405 self._show_progress_info = self._determine_show_progress_info()
406 self._collect_report_last_write = timing.Instant()
407 self._already_displayed_warnings: int | None = None
408 self._keyboardinterrupt_memo: ExceptionRepr | None = None
409
410 def _determine_show_progress_info(
411 self,

Callers

nothing calls this directly

Calls 3

getreportoptFunction · 0.85
isattyMethod · 0.45

Tested by

no test coverage detected