| 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""" |