New issue 324: -v output does not include diff that non-verbose output does for long dicts https://bitbucket.org/hpk42/tox/issues/324/v-output-does-not-include-diff-that-non
Brandon Maister: given `ex.py`: ``` #!python def test_long_assertion(): long = 'a' * 50 a = {i: long for i in range(8)} b = dict(**a) b[7] = 'short' assert a == b ``` invoking py.test gives a very helpful error message: ``` $ py.test ex.py ========= test session starts ========= platform darwin -- Python 2.7.5, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 rootdir: /private/tmp, inifile: plugins: cov-2.2.1 collected 1 items ex.py F =================== FAILURES =================== ____________________ test_long_assertion ____________________ def test_long_assertion(): long = 'a' * 50 a = {i: long for i in range(8)} b = dict(**a) b[7] = 'short' > assert a == b E assert {0: 'aaaaaaaa...aaaaaaa', ...} == {0: 'aaaaaaaaa...aaaaaaa', ...} E Omitting 7 identical items, use -v to show E Differing items: E {7: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'} != {7: 'short'} E Use -v to get the full diff ex.py:6: AssertionError ``` However, running with `-v` breaks the diff: ``` $ py.test -v ex.py ================================== test session starts =================================== platform darwin -- Python 2.7.5, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- /Users/bwm/findable/virtualenvs/consumer/bin/python cachedir: .cache rootdir: /private/tmp, inifile: plugins: cov-2.2.1 collected 1 items ex.py::test_long_assertion FAILED ======================================== FAILURES ======================================== __________________________________ test_long_assertion ___________________________________ def test_long_assertion(): long = 'a' * 50 a = {i: long for i in range(8)} b = dict(**a) b[7] = 'short' > assert a == b E assert {0: 'aaaaaaaa...aaaaaaa', ...} == {0: 'aaaaaaaaa...aaaaaaa', ...} E Common items: E {0: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', E 1: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', E 2: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', E 3: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', E 4: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', E 5: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', E 6: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'} E Differing items: E Detailed information truncated (11 more lines), use "-vv" to show ex.py:6: AssertionError ================================ 1 failed in 0.01 seconds ================================ ``` `-vv` does include everything, but it's very verbose when I have dozens of items in my dicts.
_______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit