Skip to content

Commit 7a838e2

Browse files
Merge pull request llm-d-incubation#194 from diegocastanibm/test_py_wf
Fixing bug in test. Mocking vllm for launcher test
2 parents 650c3f0 + 07bbbfa commit 7a838e2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

inference_server/launcher/tests/test_launcher.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@
1717
Run as:
1818
python -m pytest tests/test_launcher.py -v
1919
"""
20-
21-
from unittest.mock import patch
20+
import sys
21+
from unittest.mock import MagicMock, patch
2222

2323
import pytest
2424
from fastapi.testclient import TestClient
2525

26+
# Mock vllm before importing launcher
27+
sys.modules["vllm"] = MagicMock()
28+
sys.modules["vllm.utils"] = MagicMock()
29+
sys.modules["vllm.utils.argparse_utils"] = MagicMock()
30+
sys.modules["vllm.entrypoints.openai.api_server"] = MagicMock()
31+
sys.modules["vllm.entrypoints.openai.cli_args"] = MagicMock()
32+
sys.modules["vllm.entrypoints.utils"] = MagicMock()
33+
2634
# Import the application and classes
27-
from launcher import (
35+
from launcher import ( # noqa: E402
2836
VllmConfig,
2937
VllmInstance,
3038
VllmMultiProcessManager,

0 commit comments

Comments
 (0)