@@ -173,7 +173,7 @@ def __init__(self, outcome, report, logfile, config):
173
173
for extra_index , extra in enumerate (getattr (report , "extra" , [])):
174
174
self .append_extra_html (extra , extra_index , test_index )
175
175
176
- self .append_log_html (report , self .additional_html )
176
+ self .append_log_html (report , self .additional_html , config . option . capture )
177
177
178
178
cells = [
179
179
html .td (self .outcome , class_ = "col-result" ),
@@ -277,41 +277,43 @@ def append_extra_html(self, extra, extra_index, test_index):
277
277
)
278
278
self .links_html .append (" " )
279
279
280
- def append_log_html (self , report , additional_html ):
280
+ def append_log_html (self , report , additional_html , pytest_capture_value ):
281
281
log = html .div (class_ = "log" )
282
- if report .longrepr :
283
- # longreprtext is only filled out on failure by pytest
284
- # otherwise will be None.
285
- # Use full_text if longreprtext is None-ish
286
- # we added full_text elsewhere in this file.
287
- text = report .longreprtext or report .full_text
288
- for line in text .splitlines ():
289
- separator = line .startswith ("_ " * 10 )
290
- if separator :
291
- log .append (line [:80 ])
292
- else :
293
- exception = line .startswith ("E " )
294
- if exception :
295
- log .append (html .span (raw (escape (line )), class_ = "error" ))
282
+
283
+ if pytest_capture_value != "no" :
284
+ if report .longrepr :
285
+ # longreprtext is only filled out on failure by pytest
286
+ # otherwise will be None.
287
+ # Use full_text if longreprtext is None-ish
288
+ # we added full_text elsewhere in this file.
289
+ text = report .longreprtext or report .full_text
290
+ for line in text .splitlines ():
291
+ separator = line .startswith ("_ " * 10 )
292
+ if separator :
293
+ log .append (line [:80 ])
296
294
else :
297
- log .append (raw (escape (line )))
295
+ exception = line .startswith ("E " )
296
+ if exception :
297
+ log .append (html .span (raw (escape (line )), class_ = "error" ))
298
+ else :
299
+ log .append (raw (escape (line )))
300
+ log .append (html .br ())
301
+
302
+ for section in report .sections :
303
+ header , content = map (escape , section )
304
+ log .append (f" { header :-^80} " )
298
305
log .append (html .br ())
299
306
300
- for section in report .sections :
301
- header , content = map (escape , section )
302
- log .append (f" { header :-^80} " )
303
- log .append (html .br ())
304
-
305
- if ansi_support ():
306
- converter = ansi_support ().Ansi2HTMLConverter (
307
- inline = False , escaped = False
308
- )
309
- content = converter .convert (content , full = False )
310
- else :
311
- content = _remove_ansi_escape_sequences (content )
307
+ if ansi_support ():
308
+ converter = ansi_support ().Ansi2HTMLConverter (
309
+ inline = False , escaped = False
310
+ )
311
+ content = converter .convert (content , full = False )
312
+ else :
313
+ content = _remove_ansi_escape_sequences (content )
312
314
313
- log .append (raw (content ))
314
- log .append (html .br ())
315
+ log .append (raw (content ))
316
+ log .append (html .br ())
315
317
316
318
if len (log ) == 0 :
317
319
log = html .div (class_ = "empty log" )
0 commit comments