-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
pytest_make_parametrize_id hook #1535
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
pytest_make_parametrize_id hook #1535
Conversation
@@ -156,6 +156,12 @@ def pytest_pyfunc_call(pyfuncitem): | |||
def pytest_generate_tests(metafunc): | |||
""" generate (multiple) parametrized calls to a test function.""" | |||
|
|||
@hookspec(firstresult=True) | |||
def pytest_make_parametrize_id(val): |
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 thought it would be useful to also receive the config
object. Some plugin might add some custom options that might affect this.
Thanks @palaviv for taking the time to work on this! |
I added the config object to the hook. |
If nobody else wants to chime in, I will merge this tomorrow. 😁 |
since this is a new hook, can we mark it as "experimental" ? |
I'm not totally against that, but could you clarify exactly what you want "experimental" to mean here in this context? For example, we might remove arguments or the hook itself in the future? I ask because hooks are forward compatible, and if in the future we realize we need some other argument, we can just add that and not break anything. I think we should define exactly what we mean by "experimental", like what might happen in the future with that feature, and when a feature should be no longer considered experimental. Marking something as "experimental" usually discourages people from using a feature, specially if we don't exactly define what "experimental" means. |
i see, i better do a discussion on the ml then also currently only hook receivers are forward compatible |
OK, thanks! Regarding this PR, are you OK for us to merge it? If your only concern is if we should mark it as experimental or not, we can always do it later.
What do you mean by "hook receiver" exactly? |
receiver is the called hook function within a plugin |
I now see what you mean, thanks! 😄 Just to make sure I'm not missing anything then, the new |
yes |
OK 👍 |
This PR is implementing @nicoddemus suggestion in issue #930.