Skip to content

Commit 259987e

Browse files
authored
1 parent 6530f42 commit 259987e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/_pytest/config/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,8 @@ def getini(self, name: str):
15871587
``paths``, ``pathlist``, ``args`` and ``linelist`` : empty list ``[]``
15881588
``bool`` : ``False``
15891589
``string`` : empty string ``""``
1590+
``int`` : ``0``
1591+
``float`` : ``0.0``
15901592
15911593
If neither the ``default`` nor the ``type`` parameter is passed
15921594
while registering the configuration through
@@ -1656,6 +1658,16 @@ def _getini(self, name: str):
16561658
return _strtobool(str(value).strip())
16571659
elif type == "string":
16581660
return value
1661+
elif type == "int":
1662+
try:
1663+
return int(value)
1664+
except ValueError:
1665+
raise ValueError(f"invalid integer value {value!r}")
1666+
elif type == "float":
1667+
try:
1668+
return float(value)
1669+
except ValueError:
1670+
raise ValueError(f"invalid float value {value!r}")
16591671
elif type is None:
16601672
return value
16611673
else:

0 commit comments

Comments
 (0)