MCPcopy Index your code
hub / github.com/RustPython/RustPython / runTest

Method runTest

Lib/doctest.py:2309–2332  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2307 test.globs.update(self._dt_globs)
2308
2309 def runTest(self):
2310 test = self._dt_test
2311 old = sys.stdout
2312 new = StringIO()
2313 optionflags = self._dt_optionflags
2314
2315 if not (optionflags & REPORTING_FLAGS):
2316 # The option flags don't include any reporting flags,
2317 # so add the default reporting flags
2318 optionflags |= _unittest_reportflags
2319
2320 runner = DocTestRunner(optionflags=optionflags,
2321 checker=self._dt_checker, verbose=False)
2322
2323 try:
2324 runner.DIVIDER = "-"*70
2325 results = runner.run(test, out=new.write, clear_globs=False)
2326 if results.skipped == results.attempted:
2327 raise unittest.SkipTest("all examples were skipped")
2328 finally:
2329 sys.stdout = old
2330
2331 if results.failed:
2332 raise self.failureException(self.format_failure(new.getvalue().rstrip('\n')))
2333
2334 def format_failure(self, err):
2335 test = self._dt_test

Callers

nothing calls this directly

Calls 6

runMethod · 0.95
format_failureMethod · 0.95
getvalueMethod · 0.95
StringIOClass · 0.90
DocTestRunnerClass · 0.85
rstripMethod · 0.45

Tested by

no test coverage detected