Skip to content

Commit 181716d

Browse files
authored
Create 11381.improvement.rst
1 parent db57e8a commit 181716d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

changelog/11381.improvement.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
The ``type`` parameter of the ``parser.addini`` method now accepts the **int** and **float** literals, allowing the usage of those data types in the **ini** file.
2+
3+
Example:
4+
5+
.. code-block:: pytest
6+
7+
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+
)
20+
21+
The **pytest.ini** file:
22+
23+
.. code-block:: pytest
24+
25+
[pytest]
26+
int_value = 3
27+
float_value = 5.4

0 commit comments

Comments
 (0)