-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'int' and 'float' ini option types
Fixes #11381 --------- Co-authored-by: Bruno Oliveira <bruno@soliv.dev> Co-authored-by: Florian Bruhin <me@the-compiler.org>
- Loading branch information
1 parent
62aa427
commit d126389
Showing
5 changed files
with
151 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
The ``type`` parameter of the ``parser.addini`` method now accepts `"int"` and ``"float"`` parameters, facilitating the parsing of configuration values in the configuration file. | ||
|
||
Example: | ||
|
||
.. code-block:: python | ||
def pytest_addoption(parser): | ||
parser.addini("int_value", type="int", default=2, help="my int value") | ||
parser.addini("float_value", type="float", default=4.2, help="my float value") | ||
The `pytest.ini` file: | ||
|
||
.. code-block:: ini | ||
[pytest] | ||
int_value = 3 | ||
float_value = 5.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters