Skip to content

testing: fix tests when run under -v or -vv#9768

Merged
bluetech merged 2 commits intopytest-dev:mainfrom
bluetech:fix-tests-verbose
Mar 17, 2022
Merged

testing: fix tests when run under -v or -vv#9768
bluetech merged 2 commits intopytest-dev:mainfrom
bluetech:fix-tests-verbose

Conversation

@bluetech
Copy link
Member

Regressed in fac8f28, didn't notice
since we don't run tests in CI with -v.

Regressed in fac8f28, didn't notice
since we don't run tests in CI with `-v`.
@bluetech bluetech added the needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch label Mar 14, 2022
@bluetech
Copy link
Member Author

@nicoddemus the tests do give me some pause. One of the tests looks a bit like this (modified a bit):

class X1: pass
class X2: pass

cls1 = X1
cls2 = X2

def test_it():
    assert cls1 == cls2

before fac8f28 the output with pytest -vv iss

___________________________________ test_it ___________________________________

    def test_it():
>       assert cls1 == cls2
E       AssertionError: assert <class 'x.X1'> == <class 'x.X2'>
E         +<class 'x.X1'>
E         -<class 'x.X2'>

x.py:8: AssertionError
=========================== short test summary info ===========================
FAILED x.py::test_it - AssertionError: assert <class 'x.X1'> == <class 'x.X2'>

After (current main), it is

___________________________________ test_it ___________________________________

    def test_it():
>       assert cls1 == cls2
E       assert cls1 == cls2

x.py:8: AssertionError
=========================== short test summary info ===========================
FAILED x.py::test_it - assert cls1 == cls2

Now it's not printed anywhere what the cls1/cls2 runtime values are. This only happens for types which _compare_eq_any doesn't know how to handle.

@bluetech
Copy link
Member Author

I'm going to merge this since I'm doing a point release and I figure just making the tests work in the current state is uncontroversial - we can continue the discussion though.

@nicoddemus
Copy link
Member

nicoddemus commented Mar 17, 2022

Now it's not printed anywhere what the cls1/cls2 runtime values are. This only happens for types which _compare_eq_any doesn't know how to handle.

Yeah that seems bad. While the +/- diff doesn't seem that useful (and it was the target of the change), at the very least the AssertionError: assert <class 'x.X1'> == <class 'x.X2'> should be displayed.

@nicoddemus
Copy link
Member

Thanks for tackling this as well. 👍

@bluetech bluetech deleted the fix-tests-verbose branch January 23, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants