Skip to content

Allow int for max_warnings in TOML - #14954

Open
Dmao233 wants to merge 2 commits into
pytest-dev:mainfrom
Dmao233:cursor/max-warnings-toml-int-6b43
Open

Allow int for max_warnings in TOML#14954
Dmao233 wants to merge 2 commits into
pytest-dev:mainfrom
Dmao233:cursor/max-warnings-toml-int-6b43

Conversation

@Dmao233

@Dmao233 Dmao233 commented Aug 31, 2026

Copy link
Copy Markdown

Closes #14953

max_warnings was registered without a type, so native TOML integers (max_warnings = 0) were rejected even though the docs show an unquoted int.

Register it as int | str the same way as truncation_limit_*. _get_max_warnings() treats None as unset so an explicit 0 is not the empty default.

Checklist

  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits.
  • closes #14953 in the PR description and the commit.
  • Changelog file changelog/14953.bugfix.rst.
  • Added myself to AUTHORS in alphabetical order.
  • AI assistance is credited in a Co-authored-by trailer.

The max_warnings option was registered without a type (defaulting to
'string'), so integer values in native TOML config raised a TypeError.
It is now registered with type=int | str, accepting both int and string
values in TOML while keeping the string form working for backward
compatibility. An explicit integer 0 is distinguished from the unset
default.

Co-authored-by: Cursor Grok 4.6 <cursoragent@cursor.com>
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

max_warnings rejects the integer shown in the native TOML documentation

2 participants