pytest-dev/pytest-github-actions-annotate-failures

Crash on pytest error

jerry-git opened this issue · 1 comments

Example buggy test code:

import pytest

@pytest.fixture
def my_fixture():
    ...

def test_foo():
    my_fixture()

If it's ran without this plugin, pytest gives:

Fixture "my_fixture" called directly. Fixtures are not meant to be called directly,
but are created automatically when test functions request them as parameters.
See https://docs.pytest.org/en/stable/explanation/fixtures.html for more information about fixtures, and
https://docs.pytest.org/en/stable/deprecations.html#calling-fixtures-directly about how to update your code.

And if it's ran with this plugin enabled:

test_example.py
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/_pytest/main.py", line 268, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/_pytest/main.py", line 322, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/_pytest/main.py", line 347, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/_pytest/runner.py", line 111, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/_pytest/runner.py", line 130, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/_pytest/runner.py", line 221, in call_and_report
INTERNALERROR>     report: TestReport = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pluggy/_callers.py", line 55, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/Users/jerrypussinen/.virtualenvs/pytest-github-actions-annotate-failures-playground/lib/python3.9/site-packages/pytest_github_actions_annotate_failures/plugin.py", line 61, in pytest_runtest_makereport
INTERNALERROR>     longrepr += "\n\n" + report.longrepr.reprcrash.message
INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'message'

Tested with

platform darwin -- Python 3.9.8, pytest-7.1.2
plugins: github-actions-annotate-failures-0.1.7

I'm seeing the same thing on

Python 3.9.16
pytest-github-actions-annotate-failures 0.1.8
ubuntu

I don't have a simple repro case