@@ -101,6 +101,12 @@ class pytestPDB(object):
101
101
_saved = []
102
102
_recursive_debug = 0
103
103
104
+ @classmethod
105
+ def _is_capturing (cls , capman ):
106
+ if capman :
107
+ return capman .is_capturing ()
108
+ return False
109
+
104
110
@classmethod
105
111
def _init_pdb (cls , * args , ** kwargs ):
106
112
""" Initialize PDB debugging, dropping any IO capturing. """
@@ -118,10 +124,7 @@ def _init_pdb(cls, *args, **kwargs):
118
124
if header is not None :
119
125
tw .sep (">" , header )
120
126
else :
121
- if capman :
122
- capturing = capman .is_capturing ()
123
- else :
124
- capturing = False
127
+ capturing = cls ._is_capturing (capman )
125
128
if capturing :
126
129
if capturing == "global" :
127
130
tw .sep (">" , "PDB set_trace (IO-capturing turned off)" )
@@ -149,10 +152,9 @@ def do_continue(self, arg):
149
152
if cls ._recursive_debug == 0 :
150
153
tw = _pytest .config .create_terminal_writer (cls ._config )
151
154
tw .line ()
152
- if self ._pytest_capman :
153
- capturing = self ._pytest_capman .is_capturing ()
154
- else :
155
- capturing = False
155
+
156
+ capman = self ._pytest_capman
157
+ capturing = pytestPDB ._is_capturing (capman )
156
158
if capturing :
157
159
if capturing == "global" :
158
160
tw .sep (">" , "PDB continue (IO-capturing resumed)" )
@@ -162,7 +164,7 @@ def do_continue(self, arg):
162
164
"PDB continue (IO-capturing resumed for %s)"
163
165
% capturing ,
164
166
)
165
- self . _pytest_capman .resume ()
167
+ capman .resume ()
166
168
else :
167
169
tw .sep (">" , "PDB continue" )
168
170
cls ._pluginmanager .hook .pytest_leave_pdb (
0 commit comments