File tree Expand file tree Collapse file tree 4 files changed +27
-4
lines changed Expand file tree Collapse file tree 4 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 1- ``pytest.HIDDEN_PARAM `` can now be used in ``id `` of ``pytest.param `` or in ``ids `` of ``parametrize ``. It hides the parameter set from the test name.
1+ :ref: `pytest.HIDDEN_PARAM ` can now be used in ``id `` of :func: `pytest.param ` or in
2+ ``ids `` of :py:func: `Metafunc.parametrize <pytest.Metafunc.parametrize> `.
3+ It hides the parameter set from the test name.
Original file line number Diff line number Diff line change @@ -20,6 +20,16 @@ The current pytest version, as a string::
2020 >>> pytest.__version__
2121 '7.0.0'
2222
23+ .. _`pytest.HIDDEN_PARAM ref` :
24+
25+ pytest.HIDDEN_PARAM
26+ ~~~~~~~~~~~~~~~~~~~
27+
28+ .. versionadded :: 8.4
29+
30+ Can be passed to ``ids `` of :py:func: `Metafunc.parametrize <pytest.Metafunc.parametrize> `
31+ or to ``id `` of :func: `pytest.param ` to hide a parameter set from the test name.
32+ Can only be used at most 1 time, as test names need to be unique.
2333
2434.. _`version-tuple` :
2535
Original file line number Diff line number Diff line change 1212
1313from .expression import Expression
1414from .expression import ParseError
15+ from .structures import _HiddenParam
1516from .structures import EMPTY_PARAMETERSET_OPTION
1617from .structures import get_empty_parameterset_mark
1718from .structures import HIDDEN_PARAM
5051def param (
5152 * values : object ,
5253 marks : MarkDecorator | Collection [MarkDecorator | Mark ] = (),
53- id : str | None = None ,
54+ id : str | _HiddenParam | None = None ,
5455) -> ParameterSet :
5556 """Specify a parameter in `pytest.mark.parametrize`_ calls or
5657 :ref:`parametrized fixtures <fixture-parametrize-marks>`.
@@ -75,6 +76,12 @@ def test_eval(test_input, expected):
7576 :ref:`pytest.mark.usefixtures <pytest.mark.usefixtures ref>` cannot be added via this parameter.
7677
7778 :param id: The id to attribute to this parameter set.
79+
80+ .. versionadded: 8.4
81+
82+ :ref:`pytest.HIDDEN_PARAM` means to hide the parameter set
83+ from the test name. Can only be used at most 1 time, as
84+ test names need to be unique.
7885 """
7986 return ParameterSet .param (* values , marks = marks , id = id )
8087
Original file line number Diff line number Diff line change @@ -1209,8 +1209,12 @@ def parametrize(
12091209 ``bool``, or ``None``.
12101210 They are mapped to the corresponding index in ``argvalues``.
12111211 ``None`` means to use the auto-generated id.
1212- ``pytest.HIDDEN_PARAM`` means to hide the parameter set
1213- from the test name.
1212+
1213+ .. versionadded: 8.4
1214+
1215+ :ref:`pytest.HIDDEN_PARAM` means to hide the parameter set
1216+ from the test name. Can only be used at most 1 time, as
1217+ test names need to be unique.
12141218
12151219 If it is a callable it will be called for each entry in
12161220 ``argvalues``, and the return value is used as part of the
You can’t perform that action at this time.
0 commit comments