def setUp(self): if self._result_var is not None: self._old_displayhook = sys.displayhook sys.displayhook = self._displayhook super(DocTestCase, self).setUp()