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

Add -rp and -rP options to report passing tests. #1232

Merged

Conversation

codewarrior0
Copy link
Contributor

-rP is an alternative to -s for viewing the output of passing tests.
This causes the captured stdout/stderr of passing tests to be output in
the same way as that of failing tests.

-rp adds a simple one-line-per-test summary for passing tests.

Neither option is included by -ra.

Additional changes to pytest_capturelog and pytest_catchlog are
needed for this option to also output captured logs: They must be
changed to use rep.sections.add instead of rep.longrepr.addsection,
and to add these additional sections even if the test passes, since
passing tests don't seem to have a longrepr at report time.

-rP is an alternative to `-s` for viewing the output of passing tests.
This causes the captured stdout/stderr of passing tests to be output in
the same way as that of failing tests.

-rp adds a simple one-line-per-test summary for passing tests.

Neither option is included by -ra.

Additional changes to `pytest_capturelog` and `pytest_catchlog` are
needed for this option to also output captured logs: They must be
changed to use `rep.sections.add` instead of `rep.longrepr.addsection`,
and to add these additional sections even if the test passes, since
passing tests don't seem to have a `longrepr` at report time.
@codewarrior0
Copy link
Contributor Author

It looks like no changes are needed to pytest_catchlog! As of the latest master, it uses item.add_report_section instead, and the captured logs are output as expected with -rP

@nicoddemus
Copy link
Member

Could you please add yourself to AUTHORS and add a new CHANGELOG entry?

@codewarrior0
Copy link
Contributor Author

Sure thing.

@nicoddemus
Copy link
Member

I just noticed there are no tests for this feature... we should have at least two tests, one for -rp and another for -rP

@hpk42
Copy link
Contributor

hpk42 commented Dec 8, 2015

just wanted to chime in and say "yeah". Just needed "-rp" the other day. looking forward to the merge :)

@codewarrior0
Copy link
Contributor Author

Added two tests for -rp and one for -rP, based on the tests for -rf.

@codewarrior0
Copy link
Contributor Author

The -rP test now checks that the output isn't emitted when -rP isn't given. Now all four bases are covered by the tests: -rp, no -rp, -rP, and no -rP

RonnyPfannschmidt added a commit that referenced this pull request Dec 9, 2015
Add -rp and -rP options to report passing tests.
@RonnyPfannschmidt RonnyPfannschmidt merged commit 6351e28 into pytest-dev:features Dec 9, 2015
@RonnyPfannschmidt
Copy link
Member

Well done, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants