Skip to content

Combine multiple xdist_group into one #1200

Closed
@ygorpontelo

Description

@ygorpontelo

I made a modification in the hook pytest_collection_modifyitems to allow for multiple loadgroups to be combined into one. This is very useful when used with pytest.param and passing marks.

My use case was making ui tests with selenium automatically expand to include 3 different browsers, while maintaining the other mark of the specific test cases, allowing all of them to run in parallel.

The fixture was something like this:

@pytest.fixture(
    scope="session",
    params=[
        pytest.param(
            "chrome",
            marks=pytest.mark.xdist_group("chrome"),
        ),
        pytest.param(
            "firefox",
            marks=pytest.mark.xdist_group("firefox"),
        ),
        pytest.param(
            "edge",
            marks=pytest.mark.xdist_group("edge"),
        ),
    ],
)
def setup_container(...):
    ...

I have a PR to address this, should it be accepted. Tests seem to be passing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions