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

only 1 traceback displayed

Open dpinol opened this issue 2 years ago • 1 comments

According to README.md, this

def test_example():
    a = 1
    b = 2
    c = [2, 4, 6]
    check.greater(a, b)
    check.less_equal(b, a)
    check.is_in(a, c, "Is 1 in the list")
    check.is_not_in(b, c, "make sure 2 isn't in list")

should display

=================================== FAILURES ===================================
_________________________________ test_example _________________________________
FAILURE:
assert 1 > 2
  test_check.py, line 14, in test_example() -> check.greater(a, b)
FAILURE:
assert 2 <= 1
  test_check.py, line 15, in test_example() -> check.less_equal(b, a)
FAILURE: Is 1 in the list
assert 1 in [2, 4, 6]
  test_check.py, line 16, in test_example() -> check.is_in(a, c, "Is 1 in the list")
FAILURE: make sure 2 isn't in list
assert 2 not in [2, 4, 6]
  test_check.py, line 17, in test_example() -> check.is_not_in(b, c, "make sure 2 isn't in list")
------------------------------------------------------------
Failed Checks: 4
=========================== 1 failed in 0.11 seconds ===========================

On my machine, it just displays 1 traceback:

platform linux -- Python 3.11.0, pytest-7.2.1, pluggy-1.0.0
rootdir: sc-microscope, configfile: pyproject.toml
plugins: check-2.1.2
collected 1 item                                                                                                                                                           

test/gui/test_persist.py::test_example FAILED                                                                                                                        [100%]

================================================================================= FAILURES =================================================================================
_______________________________________________________________________________ test_example _______________________________________________________________________________
FAILURE: check 1 > 2
test/gui/test_persist.py:110 in test_example() -> check.greater(a, b)

FAILURE: check 2 <= 1
FAILURE: check 1 in [2, 4, 6]: Is 1 in the list
FAILURE: check 2 not in [2, 4, 6]: make sure 2 isn't in list
------------------------------------------------------------
Failed Checks: 4
========================================================================= short test summary info ==========================================================================
FAILED test/gui/test_persist.py::test_example
============================================================================ 1 failed in 0.02s =============================================================================

dpinol avatar Jan 19 '23 10:01 dpinol

You're right. We do need to update the documentation. Thanks. The flag --check-max-tb was added recently to control the number of tracebacks.
If you set --check-max-tb=5 or larger, you'll see all of those tracebacks.

okken avatar Jan 23 '23 17:01 okken