| |
25 |
#
|
| |
26 |
# Doctest and coverage don't get along, so we need to create
|
| |
27 |
# a monkeypatch that will replace the part of doctest that
|
| |
28 |
# interferes with coverage reports.
|
| |
29 |
#
|
| |
30 |
# The monkeypatch is based on this zope patch:
|
| |
31 |
# http://svn.zope.org/Zope3/trunk/src/zope/testing/doctest.py?rev=28679&r1=28703&r2=28705
|
| |
32 |
#
|
| |
33 |
_orp = doctest._OutputRedirectingPdb
|
| |
34 |
|
| |
35 |
class NoseOutputRedirectingPdb(_orp):
|
| |
36 |
def __init__(self, out):
|
| |
37 |
self.__debugger_used = False
|
| |
38 |
_orp.__init__(self, out)
|
| |
39 |
|
| |
40 |
def set_trace(self):
|
| |
41 |
self.__debugger_used = True
|
| |
42 |
_orp.set_trace(self)
|
| |
43 |
|
| |
44 |
def set_continue(self):
|
| |
45 |
# Calling set_continue unconditionally would break unit test coverage
|
| |
46 |
# reporting, as Bdb.set_continue calls sys.settrace(None).
|
| |
47 |
if self.__debugger_used:
|
| |
48 |
_orp.set_continue(self)
|
| |
49 |
doctest._OutputRedirectingPdb = NoseOutputRedirectingPdb
|
| |
50 |
|
| |
51 |
|