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

Method pytest_sessionstart

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

Source from the content-addressed store, hash-verified

845
846 @hookimpl(trylast=True)
847 def pytest_sessionstart(self, session: Session) -> None:
848 self._session = session
849 self._session_start = timing.Instant()
850 if not self.showheader:
851 return
852 self.write_sep("=", "test session starts", bold=True)
853 verinfo = platform.python_version()
854 if not self.no_header:
855 msg = f"platform {sys.platform} -- Python {verinfo}"
856 pypy_version_info = getattr(sys, "pypy_version_info", None)
857 if pypy_version_info:
858 verinfo = ".".join(map(str, pypy_version_info[:3]))
859 msg += f"[pypy-{verinfo}-{pypy_version_info[3]}]"
860 msg += f", pytest-{_pytest._version.version}, pluggy-{pluggy.__version__}"
861 if (
862 self.verbosity > 0
863 or self.config.option.debug
864 or getattr(self.config.option, "pastebin", None)
865 ):
866 msg += " -- " + str(sys.executable)
867 self.write_line(msg)
868 lines = self.config.hook.pytest_report_header(
869 config=self.config, start_path=self.startpath
870 )
871 self._write_report_lines_from_hooks(lines)
872
873 def _write_report_lines_from_hooks(
874 self, lines: Sequence[str | Sequence[str]]

Callers

nothing calls this directly

Calls 5

write_sepMethod · 0.95
write_lineMethod · 0.95
joinMethod · 0.80
pytest_report_headerMethod · 0.80

Tested by

no test coverage detected