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

Method report_collect

src/_pytest/terminal.py:643–678  ·  view source on GitHub ↗
(self, final: bool = False)

Source from the content-addressed store, hash-verified

641 self.report_collect()
642
643 def report_collect(self, final: bool = False) -> None:
644 if self.config.option.verbose < 0:
645 return
646
647 if not final:
648 # Only write "collecting" report every 0.5s.
649 t = timing.time()
650 if (
651 self._collect_report_last_write is not None
652 and self._collect_report_last_write > t - REPORT_COLLECTING_RESOLUTION
653 ):
654 return
655 self._collect_report_last_write = t
656
657 errors = len(self.stats.get("error", []))
658 skipped = len(self.stats.get("skipped", []))
659 deselected = len(self.stats.get("deselected", []))
660 selected = self._numcollected - errors - skipped - deselected
661 line = "collected " if final else "collecting "
662 line += (
663 str(self._numcollected) + " item" + ("" if self._numcollected == 1 else "s")
664 )
665 if errors:
666 line += " / %d error%s" % (errors, "s" if errors != 1 else "")
667 if deselected:
668 line += " / %d deselected" % deselected
669 if skipped:
670 line += " / %d skipped" % skipped
671 if self._numcollected > selected > 0:
672 line += " / %d selected" % selected
673 if self.isatty:
674 self.rewrite(line, bold=True, erase=True)
675 if final:
676 self.write("\n")
677 else:
678 self.write_line(line)
679
680 @hookimpl(trylast=True)
681 def pytest_sessionstart(self, session: "Session") -> None:

Callers 2

pytest_collectreportMethod · 0.95

Calls 5

rewriteMethod · 0.95
writeMethod · 0.95
write_lineMethod · 0.95
timeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected