Files
agentic-kvc/third_party/vllm/tests/test_vllm_port.py
Gahow Wang 445e491123 Add vLLM v0.18.1 source tree with KV transfer abort fix
third_party/vllm/ now tracked in git for direct patch management.
Based on vLLM v0.18.1 release with one patch applied:

  vllm/v1/core/sched/scheduler.py:
    Replace fatal assert with graceful skip when KV transfer callback
    arrives for an already-aborted request during PD disaggregated serving.

Future vLLM modifications should be made directly in third_party/vllm/
and committed normally. The patches/ directory is kept as documentation
of what changed from upstream.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-22 00:30:38 +08:00

40 lines
1.1 KiB
Python

# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import os
from unittest.mock import patch
import pytest
from vllm.envs import get_vllm_port
def test_get_vllm_port_not_set():
"""Test when VLLM_PORT is not set."""
with patch.dict(os.environ, {}, clear=True):
assert get_vllm_port() is None
def test_get_vllm_port_valid():
"""Test when VLLM_PORT is set to a valid integer."""
with patch.dict(os.environ, {"VLLM_PORT": "5678"}, clear=True):
assert get_vllm_port() == 5678
def test_get_vllm_port_invalid():
"""Test when VLLM_PORT is set to a non-integer value."""
with (
patch.dict(os.environ, {"VLLM_PORT": "abc"}, clear=True),
pytest.raises(ValueError, match="must be a valid integer"),
):
get_vllm_port()
def test_get_vllm_port_uri():
"""Test when VLLM_PORT is set to a URI."""
with (
patch.dict(os.environ, {"VLLM_PORT": "tcp://localhost:5678"}, clear=True),
pytest.raises(ValueError, match="appears to be a URI"),
):
get_vllm_port()