-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow hiding a parameter set from test name #13229
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The edge cases are well handled
We might want to bikeshed on whether to use explicit None vs missing instead of a new singleton
@RonnyPfannschmidt There are currently no public Are there any other requirements before merge? If not, then merge when ready :) |
Thanks for the elaboration 👍 Id like to see the input of some more core members before merge |
@Zac-HD @The-Compiler @jakkdl [pinging random members] Would anyone be willing to also review the PR? |
Please avoid eagerly pinging volunteers I understand the desire to finally Lan and previously have been in the same position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Left a few comments related mostly to docs.
@@ -89,6 +90,7 @@ | |||
|
|||
|
|||
__all__ = [ | |||
"HIDDEN_PARAM", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this so the list is kept sorted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatter forces ALL_CAPS
names to the top of the list
src/_pytest/python.py
Outdated
``pytest.HIDDEN_PARAM`` means to hide the parameter set | ||
from the test name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is shown here: https://pytest--13229.org.readthedocs.build/en/13229/reference/reference.html#pytest.Metafunc.parametrize
Although a bit hidden, perhaps it helps to show the version where this was added, and mentioning the restriction of it being used at most 1 time:
``pytest.HIDDEN_PARAM`` means to hide the parameter set | |
from the test name. | |
.. versionadded: 8.4 | |
``pytest.HIDDEN_PARAM`` means to hide the parameter set | |
from the test name. Can only be used at most 1 time, as | |
test names need to be unique. |
Also HIDDEN_PARAM
should appear under the Constants
at the top of the page, and then the pytest.HIDDEN_PARAM
should be a link to it.
Also it should be mentioned here: https://pytest--13229.org.readthedocs.build/en/13229/reference/reference.html#pytest-param
changelog/13228.feature.rst
Outdated
@@ -0,0 +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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change pytest.HIDDEN_PARAM
to a link to the Constants
section in the "API Reference" (see my other comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw while reviewing #13192 I noticed we will be using NotChecked
for a singleton there, should we follow suit here and use HiddenParam
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't managed to find any mentions of NotChecked
in #13192.
I've copied the naming from NOTSET
, which is also used around parameter set naming, although not public.
And they both follow PEP8 style for constants.
64b14f4
to
72b3441
Compare
@nicoddemus done, please review again |
Closes #13228