Ticket #6024: doctest_patch_for_coverage_py.diff

File doctest_patch_for_coverage_py.diff, 816 bytes (added by marcink, 17 years ago)
  • django/test/_doctest.py

     
    346346    """
    347347    def __init__(self, out):
    348348        self.__out = out
     349        self.__debugger_used = False
    349350        pdb.Pdb.__init__(self)
    350351
     352    def set_trace(self):
     353        self.__debugger_used = True
     354        pdb.Pdb.set_trace(self)
     355
     356    def set_continue(self):
     357        # Calling set_continue unconditionally would break unit test coverage
     358        # reporting, as Bdb.set_continue calls sys.settrace(None).
     359        if self.__debugger_used:
     360            pdb.Pdb.set_continue(self)
     361
     362
    351363    def trace_dispatch(self, *args):
    352364        # Redirect stdout to the given stream.
    353365        save_stdout = sys.stdout
Back to Top