File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,23 @@ def test_no_plugins_loaded_if_env_empty(monkeypatch: pytest.MonkeyPatch):
3434 assert factories == []
3535
3636
37+ def test_invalid_stat_logger_plugin_raises (monkeypatch : pytest .MonkeyPatch ):
38+ def fake_plugin_loader (group : str ):
39+ assert group == "vllm.stat_logger_plugins"
40+ return {"bad" : object ()}
41+
42+ with monkeypatch .context () as m :
43+ m .setattr (
44+ "vllm.v1.metrics.loggers.load_plugins_by_group" ,
45+ fake_plugin_loader ,
46+ )
47+ with pytest .raises (
48+ TypeError ,
49+ match = "Stat logger plugin 'bad' must be a subclass of StatLoggerBase" ,
50+ ):
51+ load_stat_logger_plugin_factories ()
52+
53+
3754@pytest .mark .asyncio
3855async def test_stat_logger_plugin_integration_with_engine (
3956 monkeypatch : pytest .MonkeyPatch ,
Original file line number Diff line number Diff line change @@ -64,12 +64,10 @@ def load_stat_logger_plugin_factories() -> list[StatLoggerFactory]:
6464 if not isinstance (plugin_class , type ) or not issubclass (
6565 plugin_class , StatLoggerBase
6666 ):
67- logger .warning (
68- "Stat logger plugin %s is not a valid subclass "
69- "of StatLoggerBase. Skipping." ,
70- name ,
67+ raise TypeError (
68+ f"Stat logger plugin { name !r} must be a subclass of "
69+ f"StatLoggerBase (got { plugin_class !r} )."
7170 )
72- continue
7371
7472 factories .append (plugin_class )
7573
You can’t perform that action at this time.
0 commit comments