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

Method pytest_sessionstart

src/_pytest/terminal.py:681–707  ·  view source on GitHub ↗
(self, session: "Session")

Source from the content-addressed store, hash-verified

679
680 @hookimpl(trylast=True)
681 def pytest_sessionstart(self, session: "Session") -> None:
682 self._session = session
683 self._sessionstarttime = timing.time()
684 if not self.showheader:
685 return
686 self.write_sep("=", "test session starts", bold=True)
687 verinfo = platform.python_version()
688 if not self.no_header:
689 msg = f"platform {sys.platform} -- Python {verinfo}"
690 pypy_version_info = getattr(sys, "pypy_version_info", None)
691 if pypy_version_info:
692 verinfo = ".".join(map(str, pypy_version_info[:3]))
693 msg += f"[pypy-{verinfo}-{pypy_version_info[3]}]"
694 msg += ", pytest-{}, pluggy-{}".format(
695 _pytest._version.version, pluggy.__version__
696 )
697 if (
698 self.verbosity > 0
699 or self.config.option.debug
700 or getattr(self.config.option, "pastebin", None)
701 ):
702 msg += " -- " + str(sys.executable)
703 self.write_line(msg)
704 lines = self.config.hook.pytest_report_header(
705 config=self.config, start_path=self.startpath
706 )
707 self._write_report_lines_from_hooks(lines)
708
709 def _write_report_lines_from_hooks(
710 self, lines: Sequence[Union[str, Sequence[str]]]

Callers

nothing calls this directly

Calls 6

write_sepMethod · 0.95
write_lineMethod · 0.95
timeMethod · 0.80
pytest_report_headerMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected