Comment 1 for bug 628300

Revision history for this message
Marius Gedminas (mgedmin) wrote :

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