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

AttributeError: 'NoneType' object has no attribute 'lineno'

jupe opened this issue · 6 comments

jupe commented

This happened once, so probably some corner case when some teardown step fails unexpectedly. Propose to add handler for this corner case to avoid unexpected AttributeError

INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pytest_github_actions_annotate_failures/plugin.py", line 65, in pytest_runtest_makereport
INTERNALERROR>     lineno = traceback_entries[0].reprfileloc.lineno
INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'lineno'
jupe commented

seems that culprits are probably 038ffa6 . @edgarrmondragon could you check it out.

@jupe So, I'm trying to think in which cases traceback_entries[0].reprfileloc is null, in order to decide whether the hook should still print something or just return early 🤔

jupe commented

we had to temporary take older release in use because of this. Did you able to reproduce the issue?

@jupe I have not been able to reproduce it, so an example would be appreciated 😄. In the meantime, you can try to install from https://github.com/edgarrmondragon/pytest-github-actions-annotate-failures/tree/67-nonetype-lineno to see if the fix there works for you.

I may have a similar problem https://github.com/scikit-hep/mplhep/actions/runs/4720311265/jobs/8372201302?pr=413
I am happy to try to isolate this for debugging, but I don't know how to simulate the GHA action run locally for that.

I may have a similar problem https://github.com/scikit-hep/mplhep/actions/runs/4720311265/jobs/8372201302?pr=413 I am happy to try to isolate this for debugging, but I don't know how to simulate the GHA action run locally for that.

@andrzejnovak thanks! You can enable the output format by setting the GITHUB_ACTIONS=true environment variable:

GITHUB_ACTIONS=true pytest