Skip to content

Exclude tests/test_ipunittest.py from trailing-whitespace pre-commit hook#15322

Merged
Carreau merged 2 commits into
mainfrom
claude/pr-15321-ci-failure-r7r0r4
Jul 21, 2026
Merged

Exclude tests/test_ipunittest.py from trailing-whitespace pre-commit hook#15322
Carreau merged 2 commits into
mainfrom
claude/pr-15321-ci-failure-r7r0r4

Conversation

@Carreau

@Carreau Carreau commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

PR #15321 (pre-commit.ci autoupdate) has widespread CI failures across the test_extra, oldest-deps, 3.14t and 3.15-dev jobs that look unrelated to the version bumps it contains, but they're actually a direct side effect of the autoupdate.

The failure is:

ValueError: line 7 of the docstring for tests.test_ipunittest.Foo.ipdt_method lacks blank after    : '   ....:'

Root cause: tests/test_ipunittest.py contains @ipdoctest/@ipdocstring fixtures whose continuation-prompt lines ( ....: ) intentionally end in trailing whitespace — IPython's ipdoctest parser (_check_prompt_blank in IPython/testing/plugin/ipdoctest.py) requires that whitespace to recognize a blank continuation line. The file has a # fmt: off comment to protect it from black/darker reformatting, but that comment has no effect on the pre-commit-hooks trailing-whitespace hook.

When pre-commit.ci ran its autofix as part of #15321's autoupdate, trailing-whitespace stripped that intentional trailing whitespace, which breaks doctest collection for Foo.ipdt_method on every job except the one Python/OS combo that happens not to hit that autofixed line count difference... in practice it broke it everywhere except the two test (ubuntu-latest, 3.13) / test (macos-14, 3.13) jobs that apparently ran before pre-commit.ci pushed its autofix commit onto the PR branch.

Fix

Add an exclude for tests/test_ipunittest.py on the trailing-whitespace hook in .pre-commit-config.yaml, so future pre-commit run --all-files invocations (including pre-commit.ci's) leave this fixture's meaningful trailing whitespace alone.

Verified locally:

  • pre-commit run trailing-whitespace --files tests/test_ipunittest.py now reports "no files to check / Skipped".
  • pytest tests/test_ipunittest.py passes (5 passed).

Test plan

  • pytest tests/test_ipunittest.py passes locally
  • pre-commit run trailing-whitespace --files tests/test_ipunittest.py skips the excluded file
  • CI green on this PR

Generated by Claude Code

claude and others added 2 commits July 21, 2026 11:43
The fixture docstrings in this file intentionally end continuation
prompt lines (e.g. "   ....:     ") with trailing whitespace, which
IPython's ipdoctest parser requires to recognize a blank continuation
line. The pre-commit-hooks "trailing-whitespace" hook doesn't honor
"# fmt: off" and strips that whitespace, which is what broke the
pre-commit autoupdate PR (#15321): once darker/pre-commit-hooks were
bumped and the autofix commit ran, the hook rewrote this file and
tests/test_ipunittest.py failed to collect with
"ValueError: line N of the docstring ... lacks blank after ...".
@Carreau
Carreau merged commit 97d75a9 into main Jul 21, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants