MCPcopy Index your code
hub / github.com/python/cpython / _printDurations

Method _printDurations

Lib/unittest/runner.py:219–239  ·  view source on GitHub ↗
(self, result)

Source from the content-addressed store, hash-verified

217 self.verbosity)
218
219 def _printDurations(self, result):
220 if not result.collectedDurations:
221 return
222 ls = sorted(result.collectedDurations, key=lambda x: x[1],
223 reverse=True)
224 if self.durations > 0:
225 ls = ls[:self.durations]
226 self.stream.writeln("Slowest test durations")
227 if hasattr(result, 'separator2'):
228 self.stream.writeln(result.separator2)
229 hidden = False
230 for test, elapsed in ls:
231 if self.verbosity < 2 and elapsed < 0.001:
232 hidden = True
233 continue
234 self.stream.writeln("%-10s %s" % ("%.3fs" % elapsed, test))
235 if hidden:
236 self.stream.writeln("\n(durations < 0.001s were hidden; "
237 "use -v to show these durations)")
238 else:
239 self.stream.writeln("")
240
241 def run(self, test):
242 "Run the given test case or test suite."

Callers 1

runMethod · 0.95

Calls 1

writelnMethod · 0.45

Tested by

no test coverage detected