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 option to force "short summary" despite high verbosity #6292

Closed
Delgan opened this issue Nov 30, 2019 · 3 comments
Closed

Add option to force "short summary" despite high verbosity #6292

Delgan opened this issue Nov 30, 2019 · 3 comments
Assignees
Labels
topic: reporting related to terminal output and user-facing messages and errors topic: rewrite related to the assertion rewrite mechanism type: enhancement new feature or API change, should be merged into features branch

Comments

@Delgan
Copy link

Delgan commented Nov 30, 2019

Hi!

By "short summary", I mean the following format with dots:

========================= test session starts ==========================
platform linux -- Python 3.7.4, pytest-4.6.2, py-1.8.0, pluggy-0.12.0
rootdir: /home/delgan/Programmation/loguru, inifile: tox.ini
plugins: xdist-1.29.0, forked-1.0.2, cov-2.7.1
collected 1154 items                                                   

tests/test_activation.py ..............................          [  2%]
tests/test_add_option_backtrace.py .                             [  2%]
tests/test_add_option_catch.py ...........                       [  3%]
tests/test_add_option_colorize.py .............................. [  6%]
tests/test_add_option_diagnose.py .                              [  7%]
tests/test_add_option_enqueue.py .........                       [  7%]
tests/test_add_option_filter.py ................................ [ 10%]
tests/test_add_option_format.py ..................               [ 14%]
tests/test_add_option_kwargs.py .......                          [ 14%]
tests/test_add_option_level.py ..........                        [ 15%]
tests/test_add_option_serialize.py ...                           [ 15%]
tests/test_add_sinks.py ...........................FFF.......... [ 19%]
tests/test_ansimarkup_basic.py ................................. [ 23%]
[...]

Versus the verbose one:

============================= test session starts ==============================

platform linux -- Python 3.5.6, pytest-5.0.1, py-1.8.0, pluggy-0.12.0
cachedir: .tox/py35/.pytest_cache
rootdir: /home/travis/build/Delgan/loguru, inifile: tox.ini
plugins: cov-2.7.1
collected 945 items                
                                            
tests/test_activation.py::test_disable[-False] PASSED                      [  0%]
tests/test_activation.py::test_disable[tests-False] PASSED                 [  0%]
tests/test_activation.py::test_disable[test-True] PASSED                   [  0%]
tests/test_activation.py::test_disable[testss-True] PASSED                 [  0%]
tests/test_activation.py::test_disable[tests.-True] PASSED                 [  0%]
tests/test_activation.py::test_disable[tests.test_activation-False] PASSED [  0%]
tests/test_activation.py::test_disable[tests.test_activation.-True] PASSED [  0%]
tests/test_activation.py::test_disable[test_activation-True] PASSED        [  0%]
tests/test_activation.py::test_disable[.-True] PASSED                      [  0%]
tests/test_activation.py::test_enable[-True] PASSED                        [  1%]
[...]

I personally find the short format more convenient: it allows me to run the tests, change screen to do something else, and come back a few dozen seconds later to see if the tests are going well (assuming that the entire session takes a minute or two to run). This allows me to see at a glance if any tests have failed, and if so, in which group there is a problem. In verbose mode, this is not the case, since the tests scroll too fast on the screen, and there is no global view. Yet, the -vv option is essential to see other useful information and avoid output to be truncated in case of failure.

Hence my question: do you think it would make sense to add an option to force the display using dots regardless of the level of verbosity?

I can definitively implement this and open a PR if you find it interesting.

@blueyed
Copy link
Contributor

blueyed commented Nov 30, 2019

Yet, the -vv option is essential to see other useful information and avoid output to be truncated in case of failure.

I think this makes sense to address instead (also) probably.
For some cases you can use CI=true pytest … already and IIRC I have a separate option in my fork already (to not truncate ever; blueyed#63).

It might still make sense to have an intermediate terminal output format though of course.. I've experimented myself with just using a single line and only adding new lines with test failures.

btw: by now you should see different colors of the progress bar if any tests failed already.

@blueyed blueyed added topic: reporting related to terminal output and user-facing messages and errors topic: rewrite related to the assertion rewrite mechanism type: enhancement new feature or API change, should be merged into features branch labels Nov 30, 2019
@Pierre-Sassoulas Pierre-Sassoulas self-assigned this Feb 6, 2024
@Morikko
Copy link

Morikko commented Jan 6, 2025

I believe this issue is done with #11653 (related issue: #11639).

Related config: verbosity_test_cases https://docs.pytest.org/en/stable/reference/reference.html#confval-verbosity_test_cases

@Pierre-Sassoulas
Copy link
Member

Thank you for the triaging @Morikko !

Set a verbosity level specifically for test case execution related output, overriding the application wide level.

        [pytest]
        verbosity_test_cases = 2

Defaults to application wide verbosity level (via the -v command-line option). A special value of
"auto" can be used to explicitly use the global verbosity level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: reporting related to terminal output and user-facing messages and errors topic: rewrite related to the assertion rewrite mechanism type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

4 participants