Skip to content

Commit 042f608

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 65cf408 commit 042f608

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

changelog/11381.improvement.rst

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@ Example:
55
.. code-block:: python
66
77
def pytest_addoption(parser):
8-
parser.addini(
9-
"int_value",
10-
type="int",
11-
default=2,
12-
help="my int value"
13-
)
14-
parser.addini(
15-
"float_value",
16-
type="float",
17-
default=4.2,
18-
help="my float value"
19-
)
8+
parser.addini("int_value", type="int", default=2, help="my int value")
9+
parser.addini("float_value", type="float", default=4.2, help="my float value")
2010
2111
The `pytest.ini` file:
2212

src/_pytest/config/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,12 +1662,16 @@ def _getini(self, name: str):
16621662
try:
16631663
return int(value)
16641664
except ValueError:
1665-
raise ValueError(f"invalid integer value for option {name}: {value!r}") from None
1665+
raise ValueError(
1666+
f"invalid integer value for option {name}: {value!r}"
1667+
) from None
16661668
elif type == "float":
16671669
try:
16681670
return float(value)
16691671
except ValueError:
1670-
raise ValueError(f"invalid float value for option {name}: {value!r}") from None
1672+
raise ValueError(
1673+
f"invalid float value for option {name}: {value!r}"
1674+
) from None
16711675
elif type is None:
16721676
return value
16731677
else:

src/_pytest/config/argparsing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ def addini(
193193
* ``pathlist``: a list of ``py.path``, separated as in a shell
194194
* ``int``: an integer
195195
* ``float``: a floating-point number
196-
196+
197197
.. versionadded:: 8.4
198-
198+
199199
The ``float`` and ``int`` types.
200200
201201
For ``paths`` and ``pathlist`` types, they are considered relative to the ini-file.

0 commit comments

Comments
 (0)