Repository navigation
Allow int for max_warnings in TOML - #14954
Conversation
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
Looks reasonable thank you.
|
Thanks. I tested the current head,
I have three questions:
|
|
Addressed in f4d3a6c.
|
|
Thanks. I reran This resolves the discrepancies identified in the comparison above. |
|
Addressed in f4d3a6c. Amine confirmed base behavior is preserved and native TOML int 0 still works. Ready for another look. |
0b7c71f to
de7bf7f
Compare
bluetech
left a comment
There was a problem hiding this comment.
Thanks. I made some tweaks.
(@Pierre-Sassoulas I kept a test otherwise we won't have coverage for the branch.)
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 <[email protected]>
de7bf7f to
ee08c00
Compare
Follow-up to pytest-dev#14692, pytest-dev#14954 and pytest-dev#15133: the remaining options whose values are naturally numbers or booleans were still registered as plain strings, so native TOML configs had to quote them. - verbosity_assertions, verbosity_test_cases, verbosity_subtests: int | Literal["auto"] - tmp_path_retention_count: int | str - log_level, log_cli_level, log_file_level: int | str; int levels are now handled directly and an int 0 (NOTSET) still counts as set - log_auto_indent: int | bool | str - log_file_mode: Literal["w", "a"] (an invalid value was an INTERNALERROR) - parametrize_long_str_id_strategy: its Literal choices The reference docs drop the "must be quoted in TOML" notes, fix the minversion TOML example (a float there is rejected), fix copy-pasted log_cli_level examples, and refresh the --help dump. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KnFJBdcVQB59PKYw3q1w7X
Closes #14953
max_warningswas 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 | strthe same way astruncation_limit_*._get_max_warnings()treatsNoneas unset so an explicit0is not the empty default.Checklist
closes #14953in the PR description and the commit.changelog/14953.bugfix.rst.AUTHORSin alphabetical order.Co-authored-bytrailer.