Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#748 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@daleselaji-dev がすでに取り組んでいます。

2026年8月9日 から。

  • #756 @daleselaji-dev による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
testing-qa

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
2.1k
フォーク
253
平均マージ
12日 4時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pytest-dev/pytest-cov のほかの issue

pytest-dev/pytest-cov の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。