-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
topic: tracebacksrelated to displaying and handling of tracebacksrelated to displaying and handling of tracebackstype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Following #13380, pytest-trio's tests fail with an IndexError when trying to display a traceback. Minimal reproducer with pytest 8.4.2 and pytest-trio 0.8.0 on Debian testing:
import pytest
@pytest.mark.trio
async def test_xfail():
pytest.xfail()pip list
Package Version
---------------- -----------
attrs 25.3.0
idna 3.10
iniconfig 2.1.0
outcome 1.3.0.post0
packaging 25.0
pip 25.2
pluggy 1.6.0
Pygments 2.19.2
pytest 8.4.2
pytest-trio 0.8.0
sniffio 1.3.1
sortedcontainers 2.4.0
trio 0.31.0
pytest output
============================================================================= test session starts ==============================================================================
platform linux -- Python 3.13.7, pytest-8.4.2, pluggy-1.6.0
rootdir: /home/cjwatson
plugins: trio-0.8.0
collected 1 item
x.py
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/main.py", line 289, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> ~~~~^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/main.py", line 343, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_hooks.py", line 512, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR> raise exception
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/logging.py", line 801, in pytest_runtestloop
INTERNALERROR> return (yield) # Run all the tests.
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/terminal.py", line 688, in pytest_runtestloop
INTERNALERROR> result = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 121, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/main.py", line 367, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_hooks.py", line 512, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR> raise exception
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/warnings.py", line 90, in pytest_runtest_protocol
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/assertion/__init__.py", line 192, in pytest_runtest_protocol
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/unittest.py", line 475, in pytest_runtest_protocol
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/faulthandler.py", line 88, in pytest_runtest_protocol
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 121, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/runner.py", line 117, in pytest_runtest_protocol
INTERNALERROR> runtestprotocol(item, nextitem=nextitem)
INTERNALERROR> ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/runner.py", line 136, in runtestprotocol
INTERNALERROR> reports.append(call_and_report(item, "call", log))
INTERNALERROR> ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/runner.py", line 248, in call_and_report
INTERNALERROR> report: TestReport = ihook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_hooks.py", line 512, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR> raise exception
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/tmpdir.py", line 308, in pytest_runtest_makereport
INTERNALERROR> rep = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/skipping.py", line 275, in pytest_runtest_makereport
INTERNALERROR> rep = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/pluggy/_callers.py", line 121, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/runner.py", line 368, in pytest_runtest_makereport
INTERNALERROR> return TestReport.from_item_and_call(item, call)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/reports.py", line 377, in from_item_and_call
INTERNALERROR> longrepr = item.repr_failure(excinfo)
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/python.py", line 1713, in repr_failure
INTERNALERROR> return self._repr_failure_py(excinfo, style=style)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/nodes.py", line 456, in _repr_failure_py
INTERNALERROR> return excinfo.getrepr(
INTERNALERROR> ~~~~~~~~~~~~~~~^
INTERNALERROR> funcargs=True,
INTERNALERROR> ^^^^^^^^^^^^^^
INTERNALERROR> ...<5 lines>...
INTERNALERROR> truncate_args=truncate_args,
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> )
INTERNALERROR> ^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/_code/code.py", line 766, in getrepr
INTERNALERROR> return fmt.repr_excinfo(self)
INTERNALERROR> ~~~~~~~~~~~~~~~~^^^^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/_code/code.py", line 1198, in repr_excinfo
INTERNALERROR> traceback[0]._rawentry,
INTERNALERROR> ~~~~~~~~~^^^
INTERNALERROR> File "/home/cjwatson/pytest-env/lib/python3.13/site-packages/_pytest/_code/code.py", line 422, in __getitem__
INTERNALERROR> return super().__getitem__(key)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~^^^^^
INTERNALERROR> IndexError: list index out of range
I filed this as python-trio/pytest-trio#151 suggesting a fix there, but one of the pytest-trio maintainers said I should file an issue here and made a couple of suggestions. This is getting out of my league - could you have a look and see where this should best be fixed? Thanks!
- a detailed description of the bug or problem you are having
- output of
pip listfrom the virtual environment you are using - pytest and operating system versions
- minimal example if possible
mridsole
Metadata
Metadata
Assignees
Labels
topic: tracebacksrelated to displaying and handling of tracebacksrelated to displaying and handling of tracebackstype: bugproblem that needs to be addressedproblem that needs to be addressed