MCPcopy Create free account
hub / github.com/ipython/ipython / runTest

Method runTest

IPython/testing/plugin/ipdoctest.py:239–268  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

237
238 # Modified runTest from the default stdlib
239 def runTest(self):
240 test = self._dt_test
241 runner = self._dt_runner
242
243 old = sys.stdout
244 new = StringIO()
245 optionflags = self._dt_optionflags
246
247 if not (optionflags & REPORTING_FLAGS):
248 # The option flags don't include any reporting flags,
249 # so add the default reporting flags
250 optionflags |= _unittest_reportflags
251
252 try:
253 # Save our current directory and switch out to the one where the
254 # test was originally created, in case another doctest did a
255 # directory change. We'll restore this in the finally clause.
256 curdir = os.getcwd()
257 #print 'runTest in dir:', self._ori_dir # dbg
258 os.chdir(self._ori_dir)
259
260 runner.DIVIDER = "-"*70
261 failures, tries = runner.run(test,out=new.write,
262 clear_globs=False)
263 finally:
264 sys.stdout = old
265 os.chdir(curdir)
266
267 if failures:
268 raise self.failureException(self.format_failure(new.getvalue()))
269
270 def setUp(self):
271 """Modified test setup that syncs with ipython namespace"""

Callers

nothing calls this directly

Calls 1

runMethod · 0.45

Tested by

no test coverage detected