You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using pytest-xdist for parallel test execution, and I have grouped my test classes into two groups using the @pytest.mark.xdist_group("group1") and @pytest.mark.xdist_group("group2") decorators.
I then use the -n 2 and --dist loadgroup options to distribute tests by their groups, which works as expected by ensuring tests from the same xdist_group are grouped together.
However, I am facing an issue where the distribution of test groups across workers is not deterministic. The following two scenarios are possible:
Scenario 1:
gw0 runs all tests decorated with @pytest.mark.xdist_group("group1"), and gw1 runs all tests decorated with @pytest.mark.xdist_group("group2").
Scenario 2:
gw0 runs all tests decorated with @pytest.mark.xdist_group("group2"), and gw1 runs all tests decorated with @pytest.mark.xdist_group("group1").
This randomness in the worker assignment is problematic for my use case.
I want to ensure that all tests marked with group1 are always assigned to gw0 and all tests marked with group2 are always assigned to gw1, with no random distribution or switching of the groups between workers.
Is there a recommended way to enforce this specific assignment of tests to workers with pytest-xdist?
The text was updated successfully, but these errors were encountered:
I am using pytest-xdist for parallel test execution, and I have grouped my test classes into two groups using the
@pytest.mark.xdist_group("group1")
and@pytest.mark.xdist_group("group2")
decorators.I then use the
-n 2 and --dist loadgroup
options to distribute tests by their groups, which works as expected by ensuring tests from the same xdist_group are grouped together.However, I am facing an issue where the distribution of test groups across workers is not deterministic. The following two scenarios are possible:
Scenario 1:
gw0 runs all tests decorated with @pytest.mark.xdist_group("group1"), and gw1 runs all tests decorated with @pytest.mark.xdist_group("group2").
Scenario 2:
gw0 runs all tests decorated with @pytest.mark.xdist_group("group2"), and gw1 runs all tests decorated with @pytest.mark.xdist_group("group1").
This randomness in the worker assignment is problematic for my use case.
I want to ensure that all tests marked with group1 are always assigned to gw0 and all tests marked with group2 are always assigned to gw1, with no random distribution or switching of the groups between workers.
Is there a recommended way to enforce this specific assignment of tests to workers with pytest-xdist?
The text was updated successfully, but these errors were encountered: