Add more parameters to overridable methods for parameterized ID creation#12628
Add more parameters to overridable methods for parameterized ID creation#12628NicoloBorghi wants to merge 26 commits intopytest-dev:mainfrom
Conversation
for more information, see https://pre-commit.ci
…ithub.com/NicoloBorghi/pytest into add-new-parameters-to-overridable-methods
for more information, see https://pre-commit.ci
…ithub.com/NicoloBorghi/pytest into add-new-parameters-to-overridable-methods
for more information, see https://pre-commit.ci
…ithub.com/NicoloBorghi/pytest into add-new-parameters-to-overridable-methods
for more information, see https://pre-commit.ci
…ithub.com/NicoloBorghi/pytest into add-new-parameters-to-overridable-methods
for more information, see https://pre-commit.ci
…ithub.com/NicoloBorghi/pytest into add-new-parameters-to-overridable-methods
for more information, see https://pre-commit.ci
…ithub.com/NicoloBorghi/pytest into add-new-parameters-to-overridable-methods
for more information, see https://pre-commit.ci
…ithub.com/NicoloBorghi/pytest into add-new-parameters-to-overridable-methods
for more information, see https://pre-commit.ci
|
I have the feeling that unit tests are failing because the changes I made are being tested with pytest themselves, which in turn doesn't contain the changes. I'm very open to suggestions. Cheers |
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
I like the idea
We need to ensure backwards compatibility and I'd like to bike shed about argument names a little
| return None | ||
| try: | ||
| id = self.idfn(val) | ||
| id = self.idfn(val, argname, idx) |
There was a problem hiding this comment.
This is a breaking change,the old signature needs to be supported as well
I recommend using a callable protocol as starting points
nicoddemus
left a comment
There was a problem hiding this comment.
We also need to update the docs, for example: https://docs.pytest.org/en/stable/example/parametrize.html
Besides this, as @RonnyPfannschmidt commented, this feature needs to be backward compatible, but I'm not sure how we can do that easily.
|
I apologize for putting up such rough code (mostly due to lack of experience). If you don't mind, we could find a way. Otherwise, feel free to decline and close this PR. Having said this, would a very crude try/except block to catch a TypeError be a potential solution? Thank you for your time. Cheers |
No problem at all, don't worry. This is good even if to at least start a conversation. 👍 |
Suggesting new feature for parameterized ID name creation. In this way, all overridable options get the same set of arguments as the main _idval method.