Skip to content

Accept numeric strings for verbosity options in TOML again, with a deprecation - #15296

Merged
RonnyPfannschmidt merged 3 commits into
mainfrom
claude/project-thread-cukdhn
Nov 4, 2026
Merged

RonnyPfannschmidt merged 3 commits into
mainfrom
claude/project-thread-cukdhn

Conversation

@RonnyPfannschmidt

@RonnyPfannschmidt RonnyPfannschmidt commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Requested by Ronny · project thread

🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.

Closes #15290.

#15153 made numeric strings like verbosity_assertions = "2" a hard error in native TOML, with no deprecation period. With this PR they are accepted again, with a deprecation warning:

  • The verbosity_* options and tmp_path_retention_count accept numeric strings in TOML again and issue one PytestRemovedIn10Warning per option. ini files are not affected.

  • Values that are neither an int nor "auto" raise a UsageError from get_verbosity.

  • The deprecation is documented in deprecations.rst#toml-numeric-strings, and the PR adds bugfix and deprecation changelog entries.

  • Tests

  • Changelog

  • AI agents credited in Co-authored-by trailers

#15153 registered the verbosity_* options as `int | Literal["auto"]`.
In native TOML mode neither member accepts a numeric string, so
`verbosity_assertions = "2"` raised a UsageError, although the changelog
promised strings keep working.

Register them as `int | str` (like tmp_path_retention_count) and validate
the string in `Config.get_verbosity`, which now raises a UsageError naming
the option for values that are neither an int nor "auto".

Fixes #15290.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pyba-chronographer pyba-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 29, 2026
@RonnyPfannschmidt RonnyPfannschmidt self-assigned this Oct 29, 2026
Native TOML has real integers, so `verbosity_assertions = "2"` is only
kept working for backward compatibility. Issue a PytestRemovedIn10Warning
once per option when get_verbosity has to convert such a string, and
document the deprecation. ini files are unaffected: the int member of
the option type converts their values before get_verbosity sees them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RonnyPfannschmidt RonnyPfannschmidt changed the title Accept numeric strings for verbosity options in native TOML again Accept numeric strings for verbosity options in TOML again, with a deprecation Oct 29, 2026
Same as the verbosity options: TOML has real integers, so a string
like "3" only stays accepted for backward compatibility and now issues
a PytestRemovedIn10Warning. The deprecation message and docs section
are generalized to cover both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@bluetech bluetech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

(I'm assuming that you checked and tmp_path_retention_count is the only other case that needs to be deprecated)

@RonnyPfannschmidt
RonnyPfannschmidt merged commit 08017d9 into main Nov 4, 2026
36 checks passed
@RonnyPfannschmidt
RonnyPfannschmidt deleted the claude/project-thread-cukdhn branch November 4, 2026 08:34
@RonnyPfannschmidt RonnyPfannschmidt added the backport 9.2.x backport this PR to 9.2.x branch label Nov 5, 2026
@patchback

patchback Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Backport to 9.2.x: 💚 backport PR created

✅ Backport PR branch: patchback/backports/9.2.x/08017d9ada4c72a7b6a78f7873c238070e24c982/pr-15296

Backported as #15339

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 9.2.x backport this PR to 9.2.x branch bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TOML config opts verbosity_assertions, verbosity_subtests, & verbosity_test_cases no longer accept numeric string values in 9.2.0

3 participants