pytest.fail() within fixture with __tracebackhide__ produces confusing output #10784
Open
4 tasks done
Labels
topic: fixtures
anything involving fixtures directly or indirectly
topic: tracebacks
related to displaying and handling of tracebacks
type: enhancement
new feature or API change, should be merged into features branch
If a fixture has
__tracebackhide__ = True
and fails:pytest.fail()
withpytrace=False
-> works greatassert
-> works ok, but still produces tracebackpytest.fail()
-> produces traceback intodef fail()
This is confusing.
In the
assert
case, the traceback is actually shown anyway, which isn't terrible but still strange.Also, the message from assert doesn't show up in the summary report, which probably isn't good either:
pytest.fail("message", pytrace=False)
assert False, "message"
pytest.fail("message", pytrace=True)
pytest.fail()
instead of test or fixture.I see that if I call
pytest.fail()
withpytrace=False
, I get the expected output of no traceback.But I think even with
pytest=True
(default), showing the tb offail()
is a bit bizarre.pip list
from the virtual environment you are usingpytest and operating system versions
pytest 7.2.1, windows 10
minimal example if possible
test_bug.py
results
The text was updated successfully, but these errors were encountered: