Skip to content

Commit 2827b3f

Browse files
[CI] Fix test_shared_storage_connector_hashes (vllm-project#25748)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
1 parent 2b6b1d7 commit 2827b3f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/v1/kv_connector/unit/test_nixl_connector.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
from vllm.distributed.kv_transfer.kv_connector.v1.nixl_connector import (
2727
KVConnectorRole, NixlAgentMetadata, NixlConnector, NixlConnectorMetadata,
2828
NixlConnectorWorker, NixlKVConnectorStats)
29+
from vllm.distributed.kv_transfer.kv_transfer_state import (
30+
ensure_kv_transfer_shutdown, has_kv_transfer_group)
2931
from vllm.forward_context import ForwardContext
3032
from vllm.platforms.interface import Platform
3133
from vllm.sampling_params import SamplingParams
@@ -35,6 +37,26 @@
3537
from .utils import create_request, create_scheduler, create_vllm_config
3638

3739

40+
@pytest.fixture(scope="module", autouse=True)
41+
def clear_kv_transfer():
42+
"""
43+
The test cases in this file use `VLLM_ENABLE_V1_MULTIPROCESSING=0`,
44+
causing the global variable `_KV_CONNECTOR_AGENT`
45+
to be assigned but never deleted.
46+
47+
Since the current pytest process does not terminate and instead
48+
continues running tests from other files,
49+
this global variable remains in memory and interferes
50+
with test cases in other modules.
51+
52+
So we use this fixture to ensure that the global variable
53+
`_KV_CONNECTOR_AGENT` is properly cleaned up after each test.
54+
"""
55+
yield
56+
if has_kv_transfer_group():
57+
ensure_kv_transfer_shutdown()
58+
59+
3860
class FakeNixlWrapper:
3961
"""Mock implementation of NixlWrapper for testing.
4062

0 commit comments

Comments
 (0)