-
Notifications
You must be signed in to change notification settings - Fork 238
Join multiple xdist_group #1201
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
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.
Thanks @ygorpontelo!
Besides the changes requested, we need:
- Tests.
- Update the documentation explaining that multiple
xdist_group
markers are merged together.
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.
Thanks @ygorpontelo for following up!
Left a few more suggestions, please take a look!
Co-authored-by: Bruno Oliveira <[email protected]>
Co-authored-by: Bruno Oliveira <[email protected]>
Co-authored-by: Bruno Oliveira <[email protected]>
for more information, see https://pre-commit.ci
Appreciate the feedback @nicoddemus! Anything else we should update? |
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.
Thanks @ygorpontelo!
@RonnyPfannschmidt would you like to do another review pass?
test_file = """ | ||
import pytest | ||
@pytest.mark.xdist_group(name="b") | ||
@pytest.mark.xdist_group(name="d") |
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.
What happens when group names get dashes underscores or other characters
In particular groupd with underscores are now ambiguous
Also what happens when the same group name come up in different order
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.
We currently add all markers to a set, then sort them and join with _
... I think this covers all cases correctly? Or do you have an example where this would cause problems?
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 underscore is just to join them, so it would form something like this: group_1 + group_2 = group_1_group_2.
-
If we want to have a unique separator to retrieve the original groups we can, but the marks still exist in the item, i just change the nodeid in this case. In any case, we can choose some other one, like "::".
-
I check if the name already exists, so every mark is unique and then sorted.Just seen nico changed to a set, neat!
if not mark: | ||
gnames: set[str] = set() | ||
for mark in item.iter_markers("xdist_group"): | ||
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.
The logic for getting the name of the mark seems involved enough to make it a function
A fun hack would be
def group_name_of(name,*k,**kw):
return name
groups = {group_name_of(*mark.args, **mark.kwargs) for mark in item.iter....}
@nicoddemus just need to merge now. |
Thanks again @ygorpontelo! |
Adressing #1200