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

Method report_collect

src/_pytest/terminal.py:810–844  ·  src/_pytest/terminal.py::TerminalReporter.report_collect
(self, final: bool = False)

Source from the content-addressed store, hash-verified

808 self.report_collect()
809
810 def report_collect(self, final: bool = False) -> None:
811 if self.config.option.verbose < 0:
812 return
813
814 if not final:
815 class="cm"># Only write the class="st">"collecting" report every `REPORT_COLLECTING_RESOLUTION`.
816 if (
817 self._collect_report_last_write.elapsed().seconds
818 < REPORT_COLLECTING_RESOLUTION
819 ):
820 return
821 self._collect_report_last_write = timing.Instant()
822
823 errors = len(self.stats.get(class="st">"error", []))
824 skipped = len(self.stats.get(class="st">"skipped", []))
825 deselected = len(self.stats.get(class="st">"deselected", []))
826 selected = self._numcollected - deselected
827 line = class="st">"collected " if final else class="st">"collecting "
828 line += (
829 str(self._numcollected) + class="st">" item" + (class="st">"" if self._numcollected == 1 else class="st">"s")
830 )
831 if errors:
832 line += fclass="st">" / {errors} error{&class="cm">#x27;s' if errors != 1 else ''}"
833 if deselected:
834 line += fclass="st">" / {deselected} deselected"
835 if skipped:
836 line += fclass="st">" / {skipped} skipped"
837 if self._numcollected > selected:
838 line += fclass="st">" / {selected} selected"
839 if self.isatty():
840 self.rewrite(line, bold=True, erase=True)
841 if final:
842 self.write(class="st">"\n")
843 else:
844 self.write_line(line)
845
846 @hookimpl(trylast=True)
847 def pytest_sessionstart(self, session: Session) -> None:

Callers 2

pytest_collectreportMethod · 0.95

Calls 6

rewriteMethod · 0.95
writeMethod · 0.95
write_lineMethod · 0.95
elapsedMethod · 0.80
getMethod · 0.45
isattyMethod · 0.45

Tested by

no test coverage detected