INTERNALERROR when generating html report using pytest-cov 7.1.0 with jinja
評価
- 難易度
- 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pytest-dev/pytest-cov のほかの issue
-
Celery tests require package; test blows up if Celery not installed instead of skipping the tests gracefully対応中かも @dchaudhari7177 が 95 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pytest-dev/pytest-cov#750 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pytest-dev/pytest-cov#617 · コメント 1 件 ·
-
Only set dynamic context on coveragepy cores supporting it, perhaps?対応中かも @terminalchai が 10 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
pytest-dev/pytest-cov#755 · コメント 3 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
pytest-dev/pytest-cov#747 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
pytest-dev/pytest-cov#746 · コメント 2 件 ·
pytest-dev/pytest-cov の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
Validate finite output clamping limits in StepPredictor.prepare_clamping_params to prevent silent NaN/Inf propagation対応中かも @muskan-creates352 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
mllam/neural-lam#848 ·
メンテナーはふだん 2 日以内に返信
-
infra
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
fab-geocommuns/RNB-coeur#1166 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
deepspeedai/DeepSpeed#8951 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws/context-ontology-accelerator#343 ·
メンテナーはふだん 1 日以内に返信