Imagine the following 5 tests:
from time import sleep
import pytest
@pytest.mark.xdist_group(name="group1")
def test_a() -> None:
assert True
@pytest.mark.xdist_group(name="group1")
def test_b() -> None:
assert True
def test_c() -> None:
sleep(100000000000)
assert True
def test_d() -> None:
sleep(100000000000)
assert True
def test_e() -> None:
assert True
With this setup, test_a
and test_b
would run in the same worker.
Because test_c
and test_d
are long running tests, I want to make sure that they run in two different workers (if possible, ie, if more than 1 worker exists, otherwise, they should run in the only existing worker). I don't care where test_e
runs.
Is there any way of accomplishing this?