Issues

Issue #128 resolved

capsys interferes with debugging

amcnabb8
created an issue

I used capsys to test the output of a function that prints to stdout. The function failed before the capsys.readouterr() line, and its output was essential to determining what went wrong. The FAILURES list in py.test did not contain any of the output. It seems that in this situation, py.test should print all of the captured output in the FAILURES list, as it would if capsys were not present.

The following paste shows a minimal example with and without capsys:

http://paste.pocoo.org/show/560459

Note that for test_nocap, "hi" appears in the "captured stdout", but for test_capsys, this information is unavailable. It seems to me that "hi" should be shown for both cases.

Thanks for the work you put into pytest; it's a great project.

Comments (4)

  1. Ronny Pfannschmidt

    this needs the introduction of a way to track sub-captures

    there is need for discussion with holger for an good approach

    currently capsys discards the output if you do not use it in the test

  2. Log in to comment