Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

INTERNALERROR when generating html report using pytest-cov 7.1.0 with jinja

Aperta
#748 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@daleselaji-dev ci sta già lavorando.

Dal 9/8/2026.

  • #756 di @daleselaji-dev — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Start with the minimal reproducer at https://github.com/cdleonard/check-pytest-cov-jinja and run uv run pytest --cov --cov-report=html. Compare that result with pytest-cov 7.0.0 using the provided command, then trace the HTML-report path shown in the traceback. Done means the Jinja template is handled without an INTERNALERROR and the HTML report is generated.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

It seems that latest version of pytest-cov will attempt to parse jinja2 files as python sources and fail. Error looks like this:

============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.1.1, pluggy-1.6.0
rootdir: /home/leonard/Projects/check-pytest-cov-jinja
configfile: pyproject.toml
plugins: cov-7.1.0
collected 1 item

test_jinja.py .
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/_pytest/main.py", line 330, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/_pytest/main.py", line 384, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 512, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/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 "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR>     raise exception
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     teardown.throw(exception)
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/_pytest/logging.py", line 816, in pytest_runtestloop
INTERNALERROR>     return (yield)  # Run all the tests.
INTERNALERROR>             ^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     teardown.throw(exception)
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/_pytest/terminal.py", line 708, in pytest_runtestloop
INTERNALERROR>     result = yield
INTERNALERROR>              ^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR>     teardown.send(result)
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/pytest_cov/plugin.py", line 362, in pytest_runtestloop
INTERNALERROR>     self.cov_total = self.cov_controller.summary(self.cov_report)
INTERNALERROR>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/pytest_cov/engine.py", line 44, in ensure_topdir_wrapper
INTERNALERROR>     return meth(self, *args, **kwargs)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/pytest_cov/engine.py", line 189, in summary
INTERNALERROR>     self.cov.html_report(ignore_errors=True, directory=output)
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/coverage/control.py", line 1275, in html_report
INTERNALERROR>     return reporter.report(morfs)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/coverage/html.py", line 392, in report
INTERNALERROR>     self.write_html_page(ftr)
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/coverage/html.py", line 481, in write_html_page
INTERNALERROR>     file_data = self.datagen.data_for_file(ftr.fr, ftr.analysis)
INTERNALERROR>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/coverage/html.py", line 152, in data_for_file
INTERNALERROR>     for lineno, tokens in enumerate(fr.source_token_lines(), start=1):
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/coverage/phystokens.py", line 136, in source_token_lines
INTERNALERROR>     soft_key_lines = find_soft_key_lines(source)
INTERNALERROR>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/leonard/Projects/check-pytest-cov-jinja/.venv/lib/python3.12/site-packages/coverage/phystokens.py", line 97, in find_soft_key_lines
INTERNALERROR>     for node in ast.walk(ast.parse(source)):
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/lib/python3.12/ast.py", line 52, in parse
INTERNALERROR>     return compile(source, filename, mode, flags,
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "<unknown>", line 2
INTERNALERROR>     {% for key in arg %}
INTERNALERROR>      ^
INTERNALERROR> SyntaxError: invalid syntax

============================== 1 passed in 0.06s ===============================

This does not happen with pytest-cov 7.0.0

Minimal project reproducing just this issue: https://github.com/cdleonard/check-pytest-cov-jinja

To reproduce the failure: uv run pytest --cov --cov-report=html
To check it works using 7.0.0: uv run --with pytest-cov==7.0.0 pytest --cov --cov-report=html

Lingua principale
Python
Stelle
2.1k
Fork
253
Merge medio
12g 4h
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pytest-dev/pytest-cov

Tutte le issue di pytest-dev/pytest-cov

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.