Skip to content

Verbose output no longer shows diff #10770

@elliotwutingfeng

Description

@elliotwutingfeng
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

When running python -m pytest -v for this function on pytest=7.1.0

def test_add():
    assert 2 + 2 == 22, "This should fail"

I get

========================================================================================= FAILURES ==========================================================================================
_________________________________________________________________________________________ test_add __________________________________________________________________________________________

    def test_add():
>       assert 2 + 2 == 22, "This should fail"
E       AssertionError: This should fail
E       assert (2 + 2) == 22

tests/test_chapter5.py:2: AssertionError

when I should be getting this instead

========================================================================================= FAILURES ==========================================================================================
_________________________________________________________________________________________ test_add __________________________________________________________________________________________

    def test_add():
>       assert 2 + 2 == 22, "This should fail"
E       AssertionError: This should fail
E       assert 4 == 22
E         +4
E         -22

tests/test_chapter5.py:2: AssertionError
  • I get the correct output on pytest=7.0.1.
  • Still getting the wrong output as of pytest=7.2.2 (current version at time of this writing).
  • The output behaviour changed from fac8f28 onwards, not sure if this is working as intended.
  • Using -vv instead of -v produces the same result.

System

Python 3.10.9. Linux x64 Kernel 6.1.12-1-MANJARO

pip list output

Package        Version
-------------- -------
attrs          22.2.0
exceptiongroup 1.1.0
iniconfig      2.0.0
more-itertools 9.1.0
packaging      23.0
pip            23.0.1
pluggy         0.13.1
py             1.11.0
pytest         7.2.2
setuptools     67.5.1
toml           0.10.2
tomli          2.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: rewriterelated to the assertion rewrite mechanismtype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions