-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
topic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature
Description
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:
$ 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:
- the
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, - more importantly, using the option and the hook feels more work than what making pytest quiet should take and
- crucially, even using the option and the hook pytest still emits an empty line.
The new line character seems to come from pytest_sessionfinish()
:
@hookimpl(wrapper=True)
def pytest_sessionfinish(
self, session: Session, exitstatus: int | ExitCode
) -> Generator[None]:
result = yield
self._tw.line("") # HERE
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:
pytest --quiet --quiet --quiet ...
pytest --really-quiet ...
pytest --no-report-on-success ...
Alternative Solutions
Running chronic pytest ...
helps, but prevents colour output.
Additional context
None.
velle and itaihay
Metadata
Metadata
Assignees
Labels
topic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errorstype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature