Open
Description
Using exc_info.exconly(tryshort=True)
is meant to remove AssertionError:
from the exception message according to (ref)
When 'tryshort' resolves to True, and the exception is an AssertionError, only the actual exception part of the exception representation is returned (so 'AssertionError: ' is removed from the beginning).
However, this is not the case. In addition, the tests do not assert this behaviour:
pytest/testing/code/test_excinfo.py
Lines 332 to 339 in 4489528
MWE
cat <<-EOF > excinfo_exconly.py
import pytest
def test():
with pytest.raises(AssertionError) as exc_info:
raise AssertionError('message')
assert exc_info.exconly(tryshort=True) == 'message'
EOF
pytest excinfo_exconly.py
Environment
Platform: linux; (Linux-5.14.21-150500.55.52-default-x86_64-with-glibc2.31)
Python version: 3.10.13 (main, Sep 05 2023, 11:46:10) [GCC])
Python implementation: CPython
Pytest version: 8.0.2