Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capsys interferes with debugging #128

Closed
pytestbot opened this issue Mar 3, 2012 · 3 comments
Closed

capsys interferes with debugging #128

pytestbot opened this issue Mar 3, 2012 · 3 comments
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: BitBucket: amcnabb8, GitHub: amcnabb8


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.


@pytestbot
Copy link
Contributor Author

Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):


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

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


fix issue128 - show captured output when capsys/capfd are in use

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


you can try installation with "pip install -i http://pypi.testrun.org -U pytest", shoulkd give you 2.2.5.dev1

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
fkohlgrueber pushed a commit to fkohlgrueber/pytest that referenced this issue Oct 27, 2018
mgorny pushed a commit to mgorny/pytest that referenced this issue May 27, 2023
* Error if hostname not defined

* Update CHANGES.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant