pytest-test-groups
pytest-test-groups copied to clipboard
The number of generated groups can be different than `test-group-count`
Due to the math in the following method:
def get_group_size(total_items, total_groups):
"""Return the group size."""
return int(math.ceil(float(total_items) / total_groups))
This can return a group_size that leads to all tests being included in a group before the last one or two groups are reached, which then creates a Invalid test-group argument error. This came up for me because we have a lot of tests split into a lot of groups.
For instance, assume we have 2001 tests split into 200 groups: so float(total_items) / total_groups)= 10.1. Taking the ceiling and integer, that's 11. But 11*199=2,189, so the 200th group will have no tests.