Skip to content

capture: keep all output for "Captured stdout call" etc #3448

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

Closed
blueyed opened this issue May 4, 2018 · 0 comments
Closed

capture: keep all output for "Captured stdout call" etc #3448

blueyed opened this issue May 4, 2018 · 0 comments
Labels
plugin: capture related to the capture builtin plugin type: enhancement new feature or API change, should be merged into features branch

Comments

@blueyed
Copy link
Contributor

blueyed commented May 4, 2018

It looks like using capfd.readouterr() in a test also resets what pytest displays in case of failed tests.

For this I think it would be useful to keep the output in total.

capfd = <_pytest.capture.CaptureFixture object at 0x7fc6da051908>

    def test_capfd(capfd):
        print('stdout')
        print(2, capfd.readouterr())
        print(3)
>       assert 0
E       assert 0

tests/test_capfd.py:11: AssertionError
----------------------------------- Captured stdout call ------------------------------------
2 CaptureResult(out='stdout\n', err='')
3

Here the stdout is missing.

pytest master (08aed1a).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: capture related to the capture builtin plugin type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

2 participants