Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNALERROR: Unknown entry type returned: TraceLastReprEntry #154

Open
filbranden opened this issue Dec 13, 2024 · 0 comments
Open

INTERNALERROR: Unknown entry type returned: TraceLastReprEntry #154

filbranden opened this issue Dec 13, 2024 · 0 comments

Comments

@filbranden
Copy link

I'm seeing INTERNALERROR: Unknown entry type returned: TraceLastReprEntry with a long long unreadable traceback when running tests for python-attrs/attrs that produce type checker failures.

This is the traceback of the exception in pytest:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/xdist/workermanage.py", line 414, in process_from_remote
INTERNALERROR>     rep = self.config.hook.pytest_report_from_serializable(
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/_pytest/reports.py", line 460, in pytest_report_from_serializable
INTERNALERROR>     return TestReport._from_json(data)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/_pytest/reports.py", line 226, in _from_json
INTERNALERROR>     kwargs = _report_kwargs_from_json(reportdict)
INTERNALERROR>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/_pytest/reports.py", line 593, in _report_kwargs_from_json
INTERNALERROR>     reprtraceback = deserialize_repr_traceback(
INTERNALERROR>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/_pytest/reports.py", line 578, in deserialize_repr_traceback
INTERNALERROR>     deserialize_repr_entry(x) for x in repr_traceback_dict["reprentries"]
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/_pytest/reports.py", line 573, in deserialize_repr_entry
INTERNALERROR>     _report_unserialization_failure(entry_type, TestReport, reportdict)
INTERNALERROR>   File "/tmp-attrs/attrs/.tox/py312-tests/lib/python3.12/site-packages/_pytest/reports.py", line 241, in _report_unserialization_failure
INTERNALERROR>     raise RuntimeError(stream.getvalue())

It looks like deserialize_repr_entry in pytest code base makes a specific check for the entry type and only supports "ReprEntry" or "ReprEntryNative", otherwise it throws this RuntimeError.

It seems updating pytest_mypy_plugins/item.py to set repr_tb_entry = ReprEntry(...) also prevents the error from happening.

In order to reproduce this issue, clone the python-attrs/attrs repo, then modify tests/test_mypy.yml to introduce any typing error, then run tox or tox -e py312-tests (quicker), the error message is very long and almost impossible to read!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant