From 8272386b797c56edad8a7aee9bdeaebfec3bdc6b Mon Sep 17 00:00:00 2001 From: NayeemJohn <44828643+NayeemJohnY@users.noreply.github.com> Date: Tue, 24 Jun 2025 22:17:21 +0530 Subject: [PATCH] Add `int` and `float` variants to Parser.addini (#13560) Fixes #13559. --------- Co-authored-by: Bruno Oliveira (cherry picked from commit ae7346114d65e3a2c0ccd77af8a0ca00012cd91d) --- changelog/13559.bugfix.rst | 1 + src/_pytest/config/argparsing.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog/13559.bugfix.rst diff --git a/changelog/13559.bugfix.rst b/changelog/13559.bugfix.rst new file mode 100644 index 00000000000..69036f784ac --- /dev/null +++ b/changelog/13559.bugfix.rst @@ -0,0 +1 @@ +Added missing `int` and `float` variants to the `Literal` type annotation of the `type` parameter in :meth:`pytest.Parser.addini`. diff --git a/src/_pytest/config/argparsing.py b/src/_pytest/config/argparsing.py index 948dfe8a510..8d4ed823325 100644 --- a/src/_pytest/config/argparsing.py +++ b/src/_pytest/config/argparsing.py @@ -174,7 +174,9 @@ def addini( self, name: str, help: str, - type: Literal["string", "paths", "pathlist", "args", "linelist", "bool"] + type: Literal[ + "string", "paths", "pathlist", "args", "linelist", "bool", "int", "float" + ] | None = None, default: Any = NOT_SET, ) -> None: