i'm using pytest-xdist to run tests in parallel, which means this plugin attempts to start multiple servers on port 8000 at the same time:
@pytest.mark.parametrize("index", list(range(6))) # or however many cores you have
def test_foo(index: int, simplehttpserver: Popen[AnyStr]): ...
when running pytest -n auto, some of these tests fail because the port is already in use.
instead, it should be able to find an unused port and return it in the simplehttpserver fixture so the test can tell what port to use:
@pytest.mark.parametrize("index", list(range(6)))
def test_foo(index: int, simplehttpserver: HttpServer):
print(server.port)