Skip to content

Failed test output is less verbose with -v than not using -v #5192

@pfctdayelise

Description

@pfctdayelise

I don't know if this has changed recently but it seems in some cases using -v makes the output less verbose...

def test_verbosity():
    s = [{'SKU': '12345678', 'Name': 'Linda', 'Description': 'Fancy dress', 'Net Price': '9.16', 'VAT rate': '20', 'VAT': '1.83', 'Gross Price': '10.99', 'Colour': 'Grey', 'Image': 'FancyDressImage'}, {'SKU': '12345679', 'Name': 'Jane', 'Description': 'Skirt', 'Net Price': '10.00', 'VAT rate': '0', 'VAT': '0.00', 'Gross Price': '10.00', 'Colour': 'Pink', 'Image': 'ChildsSkirt'}]
    assert len(s) == 1

Normal output

$ pytest -k verbosity --tb=short
====================================== test session starts ======================================
platform linux -- Python 3.6.7, pytest-4.4.1, py-1.8.0, pluggy-0.9.0
rootdir: /mnt/c/Users/bjl/wsl/bdd-examples-project/tests, inifile: pytest.ini
plugins: bdd-3.1.0
collected 27 items / 26 deselected / 1 selected

steps/test_example.py F                                                                   [100%]

=========================================== FAILURES ============================================
________________________________________ test_verbosity _________________________________________
steps/test_example.py:55: in test_verbosity
    assert len(s) == 1
E   AssertionError: assert 2 == 1
E    +  where 2 = len([{'Colour': 'Grey', 'Description': 'Fancy dress', 'Gross Price': '10.99', 'Image': 'FancyDressImage', ...}, {'Colour': 'Pink', 'Description': 'Skirt', 'Gross Price': '10.00', 'Image': 'ChildsSkirt', ...}])
============================ 1 failed, 26 deselected in 0.12 seconds ============================

Output with -v

$ pytest -k verbosity --tb=short -v
====================================== test session starts ======================================
platform linux -- Python 3.6.7, pytest-4.4.1, py-1.8.0, pluggy-0.9.0 -- /home/bjl/.local/share/virtualenvs/bdd-examples-project-dSboamh_/bin/python3
cachedir: .pytest_cache
rootdir: /mnt/c/Users/bjl/wsl/bdd-examples-project/tests, inifile: pytest.ini
plugins: bdd-3.1.0
collected 27 items / 26 deselected / 1 selected

steps/test_example.py::test_verbosity FAILED                                              [100%]

=========================================== FAILURES ============================================
________________________________________ test_verbosity _________________________________________
steps/test_example.py:55: in test_verbosity
    assert len(s) == 1
E   assert 2 == 1
E     -2
E     +1
============================ 1 failed, 26 deselected in 0.12 seconds ============================

Calling it with higher levels of verbosity (-vv, -vvv) has the same output as -v.

Using pytest 4.4.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstopic: rewriterelated to the assertion rewrite mechanismtype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions