From d5a1f59be41c6f904abc2b59371e4579895e9648 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 1 Oct 2024 10:58:59 +0100 Subject: [PATCH] test unsupported --- tests/supervisors/test_multiprocess.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/supervisors/test_multiprocess.py b/tests/supervisors/test_multiprocess.py index cd1b037f3..5ab02e018 100644 --- a/tests/supervisors/test_multiprocess.py +++ b/tests/supervisors/test_multiprocess.py @@ -233,3 +233,12 @@ def test_multiprocess_socket_balance() -> None: # pragma: py-darwin pragma: py- supervisor.join_all() min_conn, max_conn = sorted(d.values()) assert (max_conn - min_conn) < 25 + + +def test_multiprocess_not_supported(monkeypatch): + monkeypatch.delattr(socket, "SO_REUSEPORT") + config = Config(app=app, workers=2, socket_load_balance=True, port=0, interface="asgi3") + with config.bind_socket() as sock: + supervisor = Multiprocess(config, target=run, sockets=[sock]) + with pytest.raises(RuntimeError, match="socket_load_balance not supported"): + supervisor.run()