Skip to content

Commit 1ad957c

Browse files
committed
[Bugfix][Failing Test] Fix test_vllm_port.py
The urllib.parse.urlparse() function itself does not raise an exception during the parsing of a URL. However, certain attributes of the returned ParseResult object (e.g., .port) may raise a ValueError when accessed if they contain invalid values. Issue introduced in #18209 FIX: #18617 Signed-off-by: rabi <[email protected]>
1 parent 6071e98 commit 1ad957c

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

.buildkite/test-pipeline.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ steps:
199199
- tests/test_sequence
200200
- tests/test_config
201201
- tests/test_logger
202+
- tests/test_vllm_port
202203
commands:
203-
- pytest -v -s engine test_sequence.py test_config.py test_logger.py
204+
- pytest -v -s engine test_sequence.py test_config.py test_logger.py test_vllm_port.py
204205
# OOM in the CI unless we run this separately
205206
- pytest -v -s tokenization
206207

vllm/envs.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,13 @@ def get_vllm_port() -> Optional[int]:
158158
return int(port)
159159
except ValueError as err:
160160
from urllib.parse import urlparse
161-
try:
162-
parsed = urlparse(port)
163-
if parsed.scheme:
164-
raise ValueError(
165-
f"VLLM_PORT '{port}' appears to be a URI. "
166-
"This may be caused by a Kubernetes service discovery issue"
167-
"check the warning in: https://docs.vllm.ai/en/stable/usage/env_vars.html"
168-
)
169-
except Exception:
170-
pass
171-
161+
parsed = urlparse(port)
162+
if parsed.scheme:
163+
raise ValueError(
164+
f"VLLM_PORT '{port}' appears to be a URI. "
165+
"This may be caused by a Kubernetes service discovery issue,"
166+
"check the warning in: https://docs.vllm.ai/en/stable/serving/env_vars.html"
167+
) from None
172168
raise ValueError(
173169
f"VLLM_PORT '{port}' must be a valid integer") from err
174170

0 commit comments

Comments
 (0)