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

Method emit

src/_pytest/logging.py:796–813  ·  view source on GitHub ↗
(self, record: logging.LogRecord)

Source from the content-addressed store, hash-verified

794 self._test_outcome_written = False
795
796 def emit(self, record: logging.LogRecord) -> None:
797 ctx_manager = (
798 self.capture_manager.global_and_fixture_disabled()
799 if self.capture_manager
800 else nullcontext()
801 )
802 with ctx_manager:
803 if not self._first_record_emitted:
804 self.stream.write("\n")
805 self._first_record_emitted = True
806 elif self._when in ("teardown", "finish"):
807 if not self._test_outcome_written:
808 self._test_outcome_written = True
809 self.stream.write("\n")
810 if not self._section_name_shown and self._when:
811 self.stream.section("live log " + self._when, sep="-", bold=True)
812 self._section_name_shown = True
813 super().emit(record)
814
815 def handleError(self, record: logging.LogRecord) -> None:
816 # Handled by LogCaptureHandler.

Callers

nothing calls this directly

Calls 5

nullcontextFunction · 0.90
writeMethod · 0.45
sectionMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected