WIP hack around mark object [skip ci]#6410
Closed
nicoddemus wants to merge 1 commit intopytest-dev:mainfrom
Closed
WIP hack around mark object [skip ci]#6410nicoddemus wants to merge 1 commit intopytest-dev:mainfrom
nicoddemus wants to merge 1 commit intopytest-dev:mainfrom
Conversation
Member
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
lovely start, i believe we mainly need tests and a good setup for the unpacking/repacking
we might want to add a keyword only parameter called instance_of for the iteration functions
| if not isinstance(mark, Mark): | ||
| raise TypeError("got {!r} instead of Mark".format(mark)) | ||
| return [x for x in extracted if isinstance(x, Mark)] | ||
| return [getattr(mark, "mark", mark) for mark in mark_list] # unpack MarkDecorator |
Member
There was a problem hiding this comment.
for safety, this should only extract markdecorators
Member
Author
|
Note: combination should be diallowed, so this: pytest.mark(obj)(1)Should raise a `TypeError. |
This comment has been minimized.
This comment has been minimized.
Member
Author
|
Closing for now as this was mostly an experiment. I have no plans to continue working on this on the near term, but of course others are free to use this as basis to implement the whole thing! 👍 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey @RonnyPfannschmidt,
The topic of mark objects came up at work again, and I decided to be a bit of hacking to see how far I could get based on the discussion in #5424.
I basically removed some checks and made
MarkDecoratorcallable, so this is possible:No registration necessary, just a plain object with the only restriction that it needs to have a
name: strattribute (which can also be lifted easily).Wanted to share because I'm excited that this was possible with so little work (thanks to all the previous work you've done here of course).