We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There currently seems to be no easy way to make pytest not produce any output when all tests pass.
pytest --quiet --quiet ... fails to do what seems to be the most expected thing -- be quiet, still printing dots and progress information:
pytest --quiet --quiet ...
$ pytest --quiet --quiet ....... [100%]
-o console_output_style=none silences the progress and the dots can be dealt with with a pytest_report_teststatus() hook, but:
-o console_output_style=none
pytest_report_teststatus()
none
console_output_style
The new line character seems to come from pytest_sessionfinish():
pytest_sessionfinish()
@hookimpl(wrapper=True) def pytest_sessionfinish( self, session: Session, exitstatus: int | ExitCode ) -> Generator[None]: result = yield self._tw.line("") # HERE
I would expect pytest to support a command-line option or a set of options that together would make it not produce any output unless a test is failed.
Something like:
pytest --quiet --quiet --quiet ... pytest --really-quiet ... pytest --no-report-on-success ...
Running chronic pytest ... helps, but prevents colour output.
chronic pytest ...
None.
The text was updated successfully, but these errors were encountered:
I agree that -qq or -qqq would make sense for this, but I'm left wondering: Why? What's your use-case for this?
-qq
-qqq
Sorry, something went wrong.
What's your use-case for this?
It is to suppress the output that distracts, drains attention and costs time to read through on every run just to make sure tests have passed.
In my development cycle tests passing is not an event deserving attention. Them failing is.
Here's more on the same matter: https://www.linfo.org/rule_of_silence.html
Use case: I want to test that nothing in the system under test is leaking stdout or stderr logs between tests
While for the stderr case I can use pytest --quiet > /dev/null, this will not catch log messages leaking on stdout.
pytest --quiet > /dev/null
(I don't understand why --quiet wouldn't apply to progress.)
--quiet
No branches or pull requests
What's the problem this feature will solve?
There currently seems to be no easy way to make pytest not produce any output when all tests pass.
pytest --quiet --quiet ...
fails to do what seems to be the most expected thing -- be quiet, still printing dots and progress information:-o console_output_style=none
silences the progress and the dots can be dealt with with apytest_report_teststatus()
hook, but:none
only works because it's not one of the officially supported values forconsole_output_style
and the code doesn't bother raising an error,The new line character seems to come from
pytest_sessionfinish()
:Describe the solution you'd like
I would expect pytest to support a command-line option or a set of options that together would make it not produce any output unless a test is failed.
Something like:
Alternative Solutions
Running
chronic pytest ...
helps, but prevents colour output.Additional context
None.
The text was updated successfully, but these errors were encountered: