[CI/Build] Fix pre-commit (#59426)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
|
from typing import cast
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -796,6 +797,7 @@ def test_shm_receiver_requires_sender_handle_for_current_cache_key():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
sender_item, _ = sender_cache.get_and_update_item((item, []), mm_hash)
|
sender_item, _ = sender_cache.get_and_update_item((item, []), mm_hash)
|
||||||
|
assert sender_item is not None
|
||||||
|
|
||||||
valid_feature = MultiModalFeatureSpec(
|
valid_feature = MultiModalFeatureSpec(
|
||||||
data=sender_item,
|
data=sender_item,
|
||||||
@@ -897,10 +899,12 @@ def test_shm_sender_validates_client_supplied_handles():
|
|||||||
handle, _ = sender_cache.get_and_update_item(
|
handle, _ = sender_cache.get_and_update_item(
|
||||||
(MultiModalKwargsItem.dummy(1024), []), mm_hash
|
(MultiModalKwargsItem.dummy(1024), []), mm_hash
|
||||||
)
|
)
|
||||||
|
assert handle is not None
|
||||||
|
|
||||||
sender_cache.validate_input_item(handle, mm_hash)
|
sender_cache.validate_input_item(handle, mm_hash)
|
||||||
sender_cache.validate_input_item(MultiModalKwargsItem.dummy(16), mm_hash)
|
sender_cache.validate_input_item(MultiModalKwargsItem.dummy(16), mm_hash)
|
||||||
|
|
||||||
signature = handle["signature"].data
|
signature = cast(list[int], handle["signature"].data)
|
||||||
forged = [
|
forged = [
|
||||||
_with_elem(handle, "signature", [signature[0] ^ 1, *signature[1:]]),
|
_with_elem(handle, "signature", [signature[0] ^ 1, *signature[1:]]),
|
||||||
_with_elem(handle, "signature", [signature]),
|
_with_elem(handle, "signature", [signature]),
|
||||||
@@ -934,6 +938,8 @@ def test_shm_receiver_rejects_out_of_range_handle_fields():
|
|||||||
handle, _ = sender_cache.get_and_update_item(
|
handle, _ = sender_cache.get_and_update_item(
|
||||||
(MultiModalKwargsItem.dummy(1024), []), mm_hash
|
(MultiModalKwargsItem.dummy(1024), []), mm_hash
|
||||||
)
|
)
|
||||||
|
assert handle is not None
|
||||||
|
|
||||||
for key, value in [
|
for key, value in [
|
||||||
("address", -1),
|
("address", -1),
|
||||||
("address", 2**64),
|
("address", 2**64),
|
||||||
@@ -967,6 +973,8 @@ def test_shm_handle_issued_before_cache_clear():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
stale_item, _ = sender_cache.get_and_update_item((item, []), mm_hash)
|
stale_item, _ = sender_cache.get_and_update_item((item, []), mm_hash)
|
||||||
|
assert stale_item is not None
|
||||||
|
|
||||||
sender_cache.clear_cache()
|
sender_cache.clear_cache()
|
||||||
|
|
||||||
# A request still draining after the clear resolves to its own data.
|
# A request still draining after the clear resolves to its own data.
|
||||||
|
|||||||
Reference in New Issue
Block a user