@@ -187,6 +187,56 @@ def test_1():
187
187
assert "captured stderr" not in output
188
188
self .flush (child )
189
189
190
+ def test_pdb_print_captured_logs (self , testdir ):
191
+ p1 = testdir .makepyfile ("""
192
+ def test_1():
193
+ import logging
194
+ logging.warn("get rekt")
195
+ assert False
196
+ """ )
197
+ child = testdir .spawn_pytest ("--pdb %s" % p1 )
198
+ child .expect ("captured logs" )
199
+ child .expect ("get rekt" )
200
+ child .expect ("(Pdb)" )
201
+ child .sendeof ()
202
+ rest = child .read ().decode ("utf8" )
203
+ assert "1 failed" in rest
204
+ self .flush (child )
205
+
206
+ def test_pdb_dont_print_captured_logs_when_no_print_logs_is_defined (self , testdir ):
207
+ p1 = testdir .makepyfile ("""
208
+ def test_1():
209
+ import logging
210
+ logging.warn("get rekt")
211
+ assert False
212
+ """ )
213
+ child = testdir .spawn_pytest ("--pdb --no-print-logs %s" % p1 )
214
+ child .expect ("get rekt" )
215
+ output = child .before .decode ("utf8" )
216
+ assert "captured logs" not in output
217
+ child .expect ("(Pdb)" )
218
+ child .sendeof ()
219
+ rest = child .read ().decode ("utf8" )
220
+ assert "1 failed" in rest
221
+ self .flush (child )
222
+
223
+ def test_pdb_doesnt_print_captured_logs_when_logging_plugin_is_disabled (self , testdir ):
224
+ p1 = testdir .makepyfile ("""
225
+ def test_1():
226
+ import logging
227
+ logging.warn("get rekt")
228
+ assert False
229
+ """ )
230
+ child = testdir .spawn_pytest ("--pdb -p no:logging %s" % p1 )
231
+ child .expect ("get rekt" )
232
+ output = child .before .decode ("utf8" )
233
+ assert "captured logs" not in output
234
+ child .expect ("(Pdb)" )
235
+ child .sendeof ()
236
+ rest = child .read ().decode ("utf8" )
237
+ assert "1 failed" in rest
238
+ self .flush (child )
239
+
190
240
def test_pdb_interaction_exception (self , testdir ):
191
241
p1 = testdir .makepyfile ("""
192
242
import pytest
0 commit comments