Skip to content

fix(config): accept numeric string verbosity values - #15294

Closed
Lpk124 wants to merge 1 commit into
pytest-dev:mainfrom
Lpk124:fix/15290-toml-verbosity-strings
Closed

Lpk124 wants to merge 1 commit into
pytest-dev:mainfrom
Lpk124:fix/15290-toml-verbosity-strings

Conversation

@Lpk124

@Lpk124 Lpk124 commented Oct 29, 2026

Copy link
Copy Markdown

Summary

pytest 9.2.0's strict TOML union validation rejected numeric string values for the built-in verbosity settings, despite the changelog promising backward compatibility. This restores numeric string handling for:

  • verbosity_assertions
  • verbosity_subtests
  • verbosity_test_cases

The compatibility path is limited to these built-in options. Generic plugin unions such as int | str and int | Literal["auto"] keep their existing strict TOML behavior.

Tests

  • python -m pytest testing/test_config.py -q — 312 passed, 3 skipped, 1 xfailed
  • ruff check src/_pytest/config/__init__.py testing/test_config.py
  • ruff format --check src/_pytest/config/__init__.py testing/test_config.py
  • python -m py_compile src/_pytest/config/__init__.py testing/test_config.py

AI usage

Codex assisted with investigation, implementation, and tests. The submitting human reviewed and understood the complete change, and will respond to review feedback.

Closes #15290.

  • Include new tests.
  • Allow maintainers to push and squash when merging my commits.
  • AI agents are credited in the commit trailer.
  • Add a changelog entry.
  • Add the contributor to AUTHORS in alphabetical order.

Restore compatibility with pytest 9.1 for TOML verbosity options while keeping plugin-defined int | Literal unions strict.

Add regression coverage for getini and get_verbosity with both integer and numeric string TOML values.

Co-authored-by: Codex <noreply@openai.com>
@Lpk124

Lpk124 commented Oct 29, 2026 •

Copy link
Copy Markdown
Author

All checks are green on 71e82d57: the full 34-job test matrix, pre-commit, ReadTheDocs, changelog validation, and Codecov patch coverage. The change is ready for maintainer review.

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

Closing as ai slop this solves the wrong problem at the wrong place and removes a intentional tightening of the behavior

Copy link
Copy Markdown
Member

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

Superseded by #15296. It fixes the regression where the option type is declared, not with a name list in the generic _getini union path, and it adds a deprecation period for numeric strings in TOML.


Generated by Claude Code

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.

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

2 participants