I've used the following monkey-patch in one project to make --repeat work with stdlib's doctest:
import doctest orig_init = doctest.DocTestCase.__init__ def fixed_init(self, *args, **kw): orig_init(self, *args, **kw) self._dt_globs_copy = self._dt_test.globs.copy() orig_tearDown = doctest.DocTestCase.tearDown def fixed_tearDown(self): orig_tearDown(self) self._dt_test.globs.update(self._dt_globs_copy) doctest.DocTestCase.__init__ = fixed_init doctest.DocTestCase.tearDown = fixed_tearDown
I've used the following monkey-patch in one project to make --repeat work with stdlib's doctest:
import doctest DocTestCase. __init_ _
orig_init( self, *args, **kw)
self._ dt_globs_ copy = self._dt_ test.globs. copy() DocTestCase. tearDown self):
orig_tearDown( self)
self._ dt_test. globs.update( self._dt_ globs_copy) DocTestCase. __init_ _ = fixed_init DocTestCase. tearDown = fixed_tearDown
orig_init = doctest.
def fixed_init(self, *args, **kw):
orig_tearDown = doctest.
def fixed_tearDown(
doctest.
doctest.