MCPcopy Create free account
hub / github.com/pytest-dev/pytest / __init__

Method __init__

src/_pytest/terminal.py:311–335  ·  view source on GitHub ↗
(self, config: Config, file: Optional[TextIO] = None)

Source from the content-addressed store, hash-verified

309@final
310class TerminalReporter:
311 def __init__(self, config: Config, file: Optional[TextIO] = None) -> None:
312 import _pytest.config
313
314 self.config = config
315 self._numcollected = 0
316 self._session: Optional[Session] = None
317 self._showfspath: Optional[bool] = None
318
319 self.stats: Dict[str, List[Any]] = {}
320 self._main_color: Optional[str] = None
321 self._known_types: Optional[List[str]] = None
322 self.startpath = config.invocation_params.dir
323 if file is None:
324 file = sys.stdout
325 self._tw = _pytest.config.create_terminal_writer(config, file)
326 self._screen_width = self._tw.fullwidth
327 self.currentfspath: Union[None, Path, str, int] = None
328 self.reportchars = getreportopt(config)
329 self.hasmarkup = self._tw.hasmarkup
330 self.isatty = file.isatty()
331 self._progress_nodeids_reported: Set[str] = set()
332 self._show_progress_info = self._determine_show_progress_info()
333 self._collect_report_last_write: Optional[float] = None
334 self._already_displayed_warnings: Optional[int] = None
335 self._keyboardinterrupt_memo: Optional[ExceptionRepr] = None
336
337 def _determine_show_progress_info(self) -> "Literal['progress', 'count', False]":
338 """Return whether we should display progress information based on the current config."""

Callers

nothing calls this directly

Calls 3

getreportoptFunction · 0.85
isattyMethod · 0.45

Tested by

no test coverage detected