pytest-icdiff icon indicating copy to clipboard operation
pytest-icdiff copied to clipboard

expression drill-down gone?

Open davidszotten opened this issue 7 years ago • 3 comments

while the diffs are super helpful, it looks like it loses the very handy drill-down features:

def test_a():
    assert len([1, 2, 3]) == len([1, 2])

without plugin

test_foo.py:2: in test_a
    assert len([1, 2, 3]) == len([1, 2])
E   assert 3 == 2
E    +  where 3 = len([1, 2, 3])
E    +  and   2 = len([1, 2])

with plugin

test_foo.py:2: in test_a
    assert len([1, 2, 3]) == len([1, 2])
E   assert equals failed
E     3                                       2

davidszotten avatar Aug 13 '18 09:08 davidszotten

good point! any thoughts on how we could get them back?

hjwp avatar Aug 13 '18 09:08 hjwp

may be possible using hookwrapper -- https://docs.pytest.org/en/latest/writing_plugins.html#hookwrapper-executing-around-other-hooks

had a quick try but is full of pytest magic and me too tired rn.

hjwp avatar Aug 23 '18 22:08 hjwp

It occurs to me that maybe the times when you want drilldown and the times when you want icdiff aren't often the same cases -- like, in your example, we're comparing two small ints.

so one fix is maybe to special-case times when icdiff is unlikely to help, and then let pytest do its normal thing. I've added that for comparisons of numbers less than 100. Any other thoughts on when drilldown is likely to be more useful than icdiff?

hjwp avatar Mar 29 '19 16:03 hjwp