Skip to content

Commit cb54a60

Browse files
committed
tests: parametrize over --disable-frontend-multiprocessing
1 parent d859c52 commit cb54a60

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

tests/conftest.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,25 @@ def lora_adapter_path(request: pytest.FixtureRequest) -> str:
5757
return path
5858

5959

60+
@pytest.fixture(
61+
params=[
62+
pytest.param(True, id="disable-frontend-multiprocessing=True"),
63+
pytest.param(False, id="disable-frontend-multiprocessing=False"),
64+
]
65+
)
66+
def disable_frontend_multiprocessing(request):
67+
"""Enable or disable the frontend-multiprocessing feature."""
68+
return request.param
69+
70+
6071
@pytest.fixture()
61-
def args(
72+
def args( # noqa: PLR0913
6273
request: pytest.FixtureRequest,
6374
monkeypatch,
6475
grpc_server_port: ArgFixture[int],
6576
http_server_port: ArgFixture[int],
6677
lora_available: ArgFixture[bool],
78+
disable_frontend_multiprocessing,
6779
) -> argparse.Namespace:
6880
"""Return parsed CLI arguments for the adapter/vLLM."""
6981
# avoid parsing pytest arguments as vllm/vllm_tgis_adapter arguments
@@ -75,6 +87,9 @@ def args(
7587

7688
extra_args.extend(("--enable-lora", f"--lora-modules={name}={path}"))
7789

90+
if disable_frontend_multiprocessing:
91+
extra_args.append("--disable-frontend-multiprocessing")
92+
7893
monkeypatch.setattr(
7994
sys,
8095
"argv",
@@ -179,3 +194,13 @@ def target():
179194
task.cancel()
180195

181196
t.join()
197+
198+
# rorkaround: Instantiating the TGISStatLogger multiple times creates
199+
# multiple Gauges etc which can only be instantiated once.
200+
# By unregistering the Collectors from the REGISTRY we can
201+
# work around this problem.
202+
203+
from prometheus_client.registry import REGISTRY
204+
205+
for name in list(REGISTRY._collector_to_names.keys()): # noqa: SLF001
206+
REGISTRY.unregister(name)

0 commit comments

Comments
 (0)