diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 53b7dbf11..d54c2be5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,7 +31,7 @@ repos: args: - --select=F401,F821 - --fix - files: ^(benchmark/|docs/|examples/|python/sglang/|sgl-router/py_*) + files: ^(benchmark/|docs/|examples/|python/sglang/|sgl-router/py_*|test/) exclude: | (?x)^( .*/__init__\.py$| diff --git a/test/lang/test_anthropic_backend.py b/test/lang/test_anthropic_backend.py index dc8f0b17e..be4d5921c 100644 --- a/test/lang/test_anthropic_backend.py +++ b/test/lang/test_anthropic_backend.py @@ -1,4 +1,3 @@ -import json import unittest from sglang import Anthropic, set_default_backend diff --git a/test/lang/test_litellm_backend.py b/test/lang/test_litellm_backend.py index 74c3a187a..8fcc69cf7 100644 --- a/test/lang/test_litellm_backend.py +++ b/test/lang/test_litellm_backend.py @@ -1,4 +1,3 @@ -import json import unittest from sglang import LiteLLM, set_default_backend diff --git a/test/lang/test_separate_reasoning.py b/test/lang/test_separate_reasoning.py index 1709cecfd..20a8237eb 100644 --- a/test/lang/test_separate_reasoning.py +++ b/test/lang/test_separate_reasoning.py @@ -7,7 +7,7 @@ python3 -m unittest test/lang/test_separate_reasoning.py import unittest -from sglang import assistant, gen, separate_reasoning, user +from sglang import gen, separate_reasoning from sglang.lang.ir import SglExprList, SglSeparateReasoning from sglang.test.test_utils import CustomTestCase diff --git a/test/lang/test_separate_reasoning_execution.py b/test/lang/test_separate_reasoning_execution.py index 481488f6a..9dd4b4134 100644 --- a/test/lang/test_separate_reasoning_execution.py +++ b/test/lang/test_separate_reasoning_execution.py @@ -6,11 +6,9 @@ python3 -m unittest test/lang/test_separate_reasoning_execution.py """ import threading -import time import unittest from unittest.mock import MagicMock, patch -from sglang import assistant, gen, separate_reasoning, user from sglang.lang.interpreter import StreamExecutor from sglang.lang.ir import SglGen, SglSeparateReasoning from sglang.test.test_utils import CustomTestCase diff --git a/test/srt/ascend/test_ascend_deepep.py b/test/srt/ascend/test_ascend_deepep.py index eb05f559e..d6a94890a 100644 --- a/test/srt/ascend/test_ascend_deepep.py +++ b/test/srt/ascend/test_ascend_deepep.py @@ -6,7 +6,6 @@ from urllib.parse import urlparse from sglang.srt.utils import kill_process_tree from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.test_utils import ( - DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, is_in_ci, diff --git a/test/srt/ascend/test_ascend_deepseek_mtp.py b/test/srt/ascend/test_ascend_deepseek_mtp.py index d235ee59b..e149c4735 100644 --- a/test/srt/ascend/test_ascend_deepseek_mtp.py +++ b/test/srt/ascend/test_ascend_deepseek_mtp.py @@ -6,7 +6,6 @@ from urllib.parse import urlparse from sglang.srt.utils import kill_process_tree from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.test_utils import ( - DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, is_in_ci, diff --git a/test/srt/ascend/test_ascend_tp4_bf16.py b/test/srt/ascend/test_ascend_tp4_bf16.py index bb7d90e4f..e1feac417 100644 --- a/test/srt/ascend/test_ascend_tp4_bf16.py +++ b/test/srt/ascend/test_ascend_tp4_bf16.py @@ -5,7 +5,6 @@ from urllib.parse import urlparse from sglang.srt.utils import kill_process_tree from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.test_utils import ( - DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, is_in_ci, diff --git a/test/srt/cpu/test_activation.py b/test/srt/cpu/test_activation.py index 05447bc80..ffb068fc3 100644 --- a/test/srt/cpu/test_activation.py +++ b/test/srt/cpu/test_activation.py @@ -1,9 +1,7 @@ import itertools import unittest -import sgl_kernel import torch -import torch.nn.functional as F from utils import GeluAndMul, SiluAndMul, precision from sglang.srt.server_args import ServerArgs, set_global_server_args_for_scheduler diff --git a/test/srt/cpu/test_binding.py b/test/srt/cpu/test_binding.py index d3cc329af..94dd5b11b 100644 --- a/test/srt/cpu/test_binding.py +++ b/test/srt/cpu/test_binding.py @@ -1,7 +1,6 @@ import re import unittest -import sgl_kernel import torch kernel = torch.ops.sgl_kernel diff --git a/test/srt/cpu/test_comm.py b/test/srt/cpu/test_comm.py index 60e7194bd..0bd187a03 100644 --- a/test/srt/cpu/test_comm.py +++ b/test/srt/cpu/test_comm.py @@ -5,11 +5,9 @@ import traceback import unittest from multiprocessing import Process -import sgl_kernel import torch import torch.distributed as dist import torch.multiprocessing as mp -from utils import precision from sglang.test.test_utils import CustomTestCase, find_available_port diff --git a/test/srt/cpu/test_decode.py b/test/srt/cpu/test_decode.py index a7c5dd755..aaf5f5d47 100644 --- a/test/srt/cpu/test_decode.py +++ b/test/srt/cpu/test_decode.py @@ -1,6 +1,5 @@ import unittest -import sgl_kernel import torch from torch.nn.functional import scaled_dot_product_attention diff --git a/test/srt/cpu/test_extend.py b/test/srt/cpu/test_extend.py index 9c6f5b394..7277050c2 100644 --- a/test/srt/cpu/test_extend.py +++ b/test/srt/cpu/test_extend.py @@ -1,6 +1,5 @@ import unittest -import sgl_kernel import torch from torch.nn.functional import scaled_dot_product_attention diff --git a/test/srt/cpu/test_gemm.py b/test/srt/cpu/test_gemm.py index a9fe5066a..b9ec1e7bf 100644 --- a/test/srt/cpu/test_gemm.py +++ b/test/srt/cpu/test_gemm.py @@ -2,7 +2,6 @@ import itertools import unittest # TODO: use interface in cpu.py -import sgl_kernel import torch import torch.nn as nn from utils import ( diff --git a/test/srt/cpu/test_mla.py b/test/srt/cpu/test_mla.py index 1f0718d7a..3caa109d5 100644 --- a/test/srt/cpu/test_mla.py +++ b/test/srt/cpu/test_mla.py @@ -1,7 +1,5 @@ -import itertools import unittest -import sgl_kernel import torch from torch.nn.functional import scaled_dot_product_attention from utils import precision diff --git a/test/srt/cpu/test_moe.py b/test/srt/cpu/test_moe.py index 96eb28020..7babd5167 100644 --- a/test/srt/cpu/test_moe.py +++ b/test/srt/cpu/test_moe.py @@ -3,7 +3,6 @@ import math import unittest # TODO: use interface in cpu.py -import sgl_kernel import torch kernel = torch.ops.sgl_kernel diff --git a/test/srt/cpu/test_norm.py b/test/srt/cpu/test_norm.py index 75bacb198..ebae9eff6 100644 --- a/test/srt/cpu/test_norm.py +++ b/test/srt/cpu/test_norm.py @@ -2,7 +2,6 @@ import itertools import unittest from typing import Optional, Tuple, Union -import sgl_kernel import torch from utils import make_non_contiguous, precision diff --git a/test/srt/cpu/test_qkv_proj_with_rope.py b/test/srt/cpu/test_qkv_proj_with_rope.py index dc90cc559..b0b22d3bf 100644 --- a/test/srt/cpu/test_qkv_proj_with_rope.py +++ b/test/srt/cpu/test_qkv_proj_with_rope.py @@ -1,6 +1,5 @@ import unittest -import sgl_kernel import torch from utils import ( convert_weight, diff --git a/test/srt/cpu/test_rope.py b/test/srt/cpu/test_rope.py index 35c622e54..8c1dfe9aa 100644 --- a/test/srt/cpu/test_rope.py +++ b/test/srt/cpu/test_rope.py @@ -1,6 +1,5 @@ import unittest -import sgl_kernel import torch from utils import precision diff --git a/test/srt/cpu/test_shared_expert.py b/test/srt/cpu/test_shared_expert.py index 6086fed65..358709a6a 100644 --- a/test/srt/cpu/test_shared_expert.py +++ b/test/srt/cpu/test_shared_expert.py @@ -3,9 +3,7 @@ import math import unittest # TODO: use interface in cpu.py -import sgl_kernel import torch -import torch.nn as nn from utils import ( BLOCK_K, BLOCK_N, diff --git a/test/srt/cpu/test_topk.py b/test/srt/cpu/test_topk.py index 4b4ce21ae..9f3dfc1b4 100644 --- a/test/srt/cpu/test_topk.py +++ b/test/srt/cpu/test_topk.py @@ -1,9 +1,6 @@ -import itertools import unittest -import sgl_kernel import torch -from utils import precision from sglang.srt.layers.moe.topk import ( biased_grouped_topk_impl as native_biased_grouped_topk, diff --git a/test/srt/entrypoints/http_server/test_abort_request.py b/test/srt/entrypoints/http_server/test_abort_request.py index 7a366f244..7d9a60a1b 100644 --- a/test/srt/entrypoints/http_server/test_abort_request.py +++ b/test/srt/entrypoints/http_server/test_abort_request.py @@ -8,7 +8,6 @@ Run with: import threading import time import unittest -from typing import Optional import requests diff --git a/test/srt/ep/test_deepep_intranode.py b/test/srt/ep/test_deepep_intranode.py index 97acd000c..ef365b010 100644 --- a/test/srt/ep/test_deepep_intranode.py +++ b/test/srt/ep/test_deepep_intranode.py @@ -1,6 +1,5 @@ # Copy from deepseek-ai/DeepEP/tests/test_intranode.py -import os import time # noinspection PyUnresolvedReferences diff --git a/test/srt/ep/test_deepep_small.py b/test/srt/ep/test_deepep_small.py index 05aefe79a..4417affb9 100644 --- a/test/srt/ep/test_deepep_small.py +++ b/test/srt/ep/test_deepep_small.py @@ -317,7 +317,6 @@ class TestMTP(CustomTestCase): class TestMTPWithTBO(CustomTestCase): @classmethod def setUpClass(cls): - import os cls.model = DEFAULT_MODEL_NAME_FOR_TEST_MLA cls.base_url = DEFAULT_URL_FOR_TEST diff --git a/test/srt/ep/test_eplb.py b/test/srt/ep/test_eplb.py index 748dd39c8..0da365f33 100755 --- a/test/srt/ep/test_eplb.py +++ b/test/srt/ep/test_eplb.py @@ -1,4 +1,3 @@ -import os import tempfile import unittest from pathlib import Path diff --git a/test/srt/ep/test_moe_deepep.py b/test/srt/ep/test_moe_deepep.py index 00f7cd59b..495a3aeff 100644 --- a/test/srt/ep/test_moe_deepep.py +++ b/test/srt/ep/test_moe_deepep.py @@ -1,5 +1,4 @@ import json -import os import unittest from types import SimpleNamespace diff --git a/test/srt/experiment_runner.py b/test/srt/experiment_runner.py index f32f61d3b..f6af05623 100644 --- a/test/srt/experiment_runner.py +++ b/test/srt/experiment_runner.py @@ -8,8 +8,7 @@ import threading import time from dataclasses import dataclass from datetime import datetime -from pathlib import Path -from typing import Dict, List, Optional, Tuple +from typing import List, Optional, Tuple import psutil import requests diff --git a/test/srt/function_call/test_json_schema_constraint.py b/test/srt/function_call/test_json_schema_constraint.py index 962d97ea2..b1e6195e7 100644 --- a/test/srt/function_call/test_json_schema_constraint.py +++ b/test/srt/function_call/test_json_schema_constraint.py @@ -12,7 +12,6 @@ from sglang.srt.entrypoints.openai.protocol import ( ToolChoice, ToolChoiceFuncName, ) -from sglang.srt.function_call.function_call_parser import FunctionCallParser from sglang.srt.function_call.utils import ( _get_tool_schema_defs, get_json_schema_constraint, diff --git a/test/srt/hicache/test_hicache_storage_3fs_backend.py b/test/srt/hicache/test_hicache_storage_3fs_backend.py index d3dea5117..c91772881 100644 --- a/test/srt/hicache/test_hicache_storage_3fs_backend.py +++ b/test/srt/hicache/test_hicache_storage_3fs_backend.py @@ -6,13 +6,10 @@ Usage: import json import os -import time import unittest -from types import SimpleNamespace from test_hicache_storage_file_backend import HiCacheStorageBaseMixin -from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.test_utils import CustomTestCase diff --git a/test/srt/layers/moe/test_moe_runners.py b/test/srt/layers/moe/test_moe_runners.py index f325a0212..4b4047d4b 100644 --- a/test/srt/layers/moe/test_moe_runners.py +++ b/test/srt/layers/moe/test_moe_runners.py @@ -4,11 +4,9 @@ from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( - DEFAULT_AWQ_MOE_MODEL_NAME_FOR_TEST, DEFAULT_MODEL_NAME_FOR_TEST_FP8_WITH_MOE, DEFAULT_MODEL_NAME_FOR_TEST_MOE_NVFP4, DEFAULT_MODEL_NAME_FOR_TEST_MXFP4_WITH_MOE, - DEFAULT_MODEL_NAME_FOR_TEST_W8A8_WITH_MOE, DEFAULT_SMALL_MOE_MODEL_NAME_FOR_TEST_CHAT, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, diff --git a/test/srt/lora/test_lora.py b/test/srt/lora/test_lora.py index 3ab7b624d..aff0b3a79 100644 --- a/test/srt/lora/test_lora.py +++ b/test/srt/lora/test_lora.py @@ -18,7 +18,6 @@ import random import unittest from typing import List -import torch from utils import ( ALL_OTHER_MULTI_LORA_MODELS, CI_MULTI_LORA_MODELS, diff --git a/test/srt/lora/test_lora_openai_api.py b/test/srt/lora/test_lora_openai_api.py index 4f5ac5303..649e4424e 100644 --- a/test/srt/lora/test_lora_openai_api.py +++ b/test/srt/lora/test_lora_openai_api.py @@ -6,7 +6,7 @@ that enables OpenAI-compatible LoRA adapter selection. """ import unittest -from unittest.mock import MagicMock, Mock +from unittest.mock import MagicMock from sglang.srt.entrypoints.openai.serving_base import OpenAIServingBase from sglang.srt.server_args import ServerArgs diff --git a/test/srt/lora/test_lora_radix_cache.py b/test/srt/lora/test_lora_radix_cache.py index 2faacf930..8dcd09b79 100644 --- a/test/srt/lora/test_lora_radix_cache.py +++ b/test/srt/lora/test_lora_radix_cache.py @@ -13,13 +13,11 @@ # ============================================================================== import multiprocessing as mp -import random import unittest import torch -from utils import CI_MULTI_LORA_MODELS, DEFAULT_PROMPTS, run_lora_test_one_by_one +from utils import CI_MULTI_LORA_MODELS, run_lora_test_one_by_one -from sglang.test.runners import HFRunner, SRTRunner from sglang.test.test_utils import CustomTestCase PROMPTS = [ diff --git a/test/srt/lora/utils.py b/test/srt/lora/utils.py index 95089d33c..27e6b72c7 100644 --- a/test/srt/lora/utils.py +++ b/test/srt/lora/utils.py @@ -14,7 +14,7 @@ import dataclasses import random -from typing import List, Optional +from typing import List import torch diff --git a/test/srt/models/test_clip_models.py b/test/srt/models/test_clip_models.py index 8a79656d0..e537a7466 100644 --- a/test/srt/models/test_clip_models.py +++ b/test/srt/models/test_clip_models.py @@ -16,10 +16,8 @@ import multiprocessing as mp import unittest import torch -from transformers import AutoProcessor -from sglang.srt.utils import load_image -from sglang.test.runners import DEFAULT_PROMPTS, HFRunner, SRTRunner +from sglang.test.runners import HFRunner, SRTRunner from sglang.test.test_utils import get_similarities TEXTS = "two Subway Series sandwiches with meats, cheese, lettuce, tomatoes, and onions on a black background, accompanied by the Subway Series logo, highlighting a new sandwich series." diff --git a/test/srt/models/test_cross_encoder_models.py b/test/srt/models/test_cross_encoder_models.py index 93edc3fa1..6ff963dd4 100644 --- a/test/srt/models/test_cross_encoder_models.py +++ b/test/srt/models/test_cross_encoder_models.py @@ -3,7 +3,6 @@ import random import unittest import torch -from transformers import AutoConfig, AutoTokenizer from sglang.test.runners import TEST_RERANK_QUERY_DOCS, HFRunner, SRTRunner from sglang.test.test_utils import CustomTestCase, is_in_ci diff --git a/test/srt/models/test_falcon_h1_models.py b/test/srt/models/test_falcon_h1_models.py index cb32a7ef1..1706cc859 100644 --- a/test/srt/models/test_falcon_h1_models.py +++ b/test/srt/models/test_falcon_h1_models.py @@ -1,4 +1,3 @@ -import unittest from types import SimpleNamespace from sglang.srt.utils import kill_process_tree diff --git a/test/srt/models/test_generation_models.py b/test/srt/models/test_generation_models.py index 4aab2246e..43770d5a1 100644 --- a/test/srt/models/test_generation_models.py +++ b/test/srt/models/test_generation_models.py @@ -22,7 +22,6 @@ To test a specific model locally: import dataclasses import multiprocessing as mp import os -import random import unittest from typing import List diff --git a/test/srt/models/test_llama4_models.py b/test/srt/models/test_llama4_models.py index 3835ca8d7..cb0c57604 100644 --- a/test/srt/models/test_llama4_models.py +++ b/test/srt/models/test_llama4_models.py @@ -1,4 +1,3 @@ -import random import unittest from types import SimpleNamespace diff --git a/test/srt/nightly/test_gsm8k_eval_amd.py b/test/srt/nightly/test_gsm8k_eval_amd.py index 232fde507..f27998632 100644 --- a/test/srt/nightly/test_gsm8k_eval_amd.py +++ b/test/srt/nightly/test_gsm8k_eval_amd.py @@ -2,7 +2,6 @@ import json import os import unittest import warnings -from datetime import datetime from types import SimpleNamespace from sglang.srt.utils import kill_process_tree diff --git a/test/srt/openai_server/basic/test_openai_embedding.py b/test/srt/openai_server/basic/test_openai_embedding.py index d198b1a7f..21da5dd84 100644 --- a/test/srt/openai_server/basic/test_openai_embedding.py +++ b/test/srt/openai_server/basic/test_openai_embedding.py @@ -1,8 +1,6 @@ import json -import os import unittest -import numpy as np import openai from sglang.srt.utils import kill_process_tree diff --git a/test/srt/openai_server/basic/test_openai_server.py b/test/srt/openai_server/basic/test_openai_server.py index c32ef9e90..9b09fbfaf 100644 --- a/test/srt/openai_server/basic/test_openai_server.py +++ b/test/srt/openai_server/basic/test_openai_server.py @@ -7,12 +7,10 @@ python3 -m unittest openai_server.basic.test_openai_server.TestOpenAIServer.test import json import random -import re import unittest from concurrent.futures import ThreadPoolExecutor from typing import Optional -import numpy as np import openai import requests diff --git a/test/srt/openai_server/basic/test_protocol.py b/test/srt/openai_server/basic/test_protocol.py index fbf1e3971..289b6638d 100644 --- a/test/srt/openai_server/basic/test_protocol.py +++ b/test/srt/openai_server/basic/test_protocol.py @@ -13,53 +13,19 @@ # ============================================================================== """Tests for OpenAI API protocol models""" -import json -import time import unittest -from typing import Dict, List, Optional +from typing import List, Optional from pydantic import BaseModel, Field, ValidationError from sglang.srt.entrypoints.openai.protocol import ( - BatchRequest, - BatchResponse, - ChatCompletionMessageContentImagePart, - ChatCompletionMessageContentTextPart, ChatCompletionRequest, ChatCompletionResponse, ChatCompletionResponseChoice, - ChatCompletionResponseStreamChoice, - ChatCompletionStreamResponse, - ChatCompletionTokenLogprob, ChatMessage, - ChoiceLogprobs, CompletionRequest, - CompletionResponse, - CompletionResponseChoice, - DeltaMessage, - EmbeddingObject, - EmbeddingRequest, - EmbeddingResponse, - ErrorResponse, - FileDeleteResponse, - FileRequest, - FileResponse, - Function, - FunctionResponse, - JsonSchemaResponseFormat, - LogProbs, ModelCard, ModelList, - MultimodalEmbeddingInput, - ResponseFormat, - ScoringRequest, - ScoringResponse, - StreamOptions, - StructuralTagResponseFormat, - Tool, - ToolCall, - ToolChoice, - TopLogprob, UsageInfo, ) diff --git a/test/srt/openai_server/basic/test_serving_completions.py b/test/srt/openai_server/basic/test_serving_completions.py index 022ba9ad1..93aba834e 100644 --- a/test/srt/openai_server/basic/test_serving_completions.py +++ b/test/srt/openai_server/basic/test_serving_completions.py @@ -6,7 +6,7 @@ Run with: import unittest from typing import Optional -from unittest.mock import AsyncMock, Mock, patch +from unittest.mock import AsyncMock, Mock from sglang.srt.entrypoints.openai.protocol import CompletionRequest from sglang.srt.entrypoints.openai.serving_completions import OpenAIServingCompletion diff --git a/test/srt/openai_server/basic/test_serving_embedding.py b/test/srt/openai_server/basic/test_serving_embedding.py index 47f8330b7..2621eb521 100644 --- a/test/srt/openai_server/basic/test_serving_embedding.py +++ b/test/srt/openai_server/basic/test_serving_embedding.py @@ -10,7 +10,6 @@ from fastapi import Request from sglang.srt.entrypoints.openai.protocol import ( EmbeddingRequest, - EmbeddingResponse, MultimodalEmbeddingInput, ) from sglang.srt.entrypoints.openai.serving_embedding import OpenAIServingEmbedding diff --git a/test/srt/openai_server/features/test_cache_report.py b/test/srt/openai_server/features/test_cache_report.py index 939556993..6a5f7bd8a 100644 --- a/test/srt/openai_server/features/test_cache_report.py +++ b/test/srt/openai_server/features/test_cache_report.py @@ -1,4 +1,3 @@ -import asyncio import unittest import openai diff --git a/test/srt/openai_server/features/test_enable_thinking.py b/test/srt/openai_server/features/test_enable_thinking.py index 5e03d17de..5687c68e2 100644 --- a/test/srt/openai_server/features/test_enable_thinking.py +++ b/test/srt/openai_server/features/test_enable_thinking.py @@ -6,18 +6,12 @@ python3 -m unittest openai_server.features.test_enable_thinking.TestEnableThinki python3 -m unittest openai_server.features.test_enable_thinking.TestEnableThinking.test_stream_chat_completion_without_reasoning """ -import asyncio import json -import os -import sys -import time import unittest -import openai import requests from sglang.srt.utils import kill_process_tree -from sglang.srt.utils.hf_transformers_utils import get_tokenizer from sglang.test.test_utils import ( DEFAULT_ENABLE_THINKING_MODEL_NAME_FOR_TEST, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, diff --git a/test/srt/openai_server/features/test_openai_server_hidden_states.py b/test/srt/openai_server/features/test_openai_server_hidden_states.py index bb066e691..6544a9a87 100644 --- a/test/srt/openai_server/features/test_openai_server_hidden_states.py +++ b/test/srt/openai_server/features/test_openai_server_hidden_states.py @@ -1,19 +1,13 @@ -import json -import re -import time import unittest from abc import ABC -import numpy as np import openai -import torch from sglang.srt.utils import kill_process_tree from sglang.srt.utils.hf_transformers_utils import get_tokenizer from sglang.test.test_utils import ( DEFAULT_EAGLE_DRAFT_MODEL_FOR_TEST, DEFAULT_EAGLE_TARGET_MODEL_FOR_TEST, - DEFAULT_SMALL_EMBEDDING_MODEL_NAME_FOR_TEST, DEFAULT_SMALL_MODEL_NAME_FOR_TEST, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, diff --git a/test/srt/openai_server/features/test_reasoning_content.py b/test/srt/openai_server/features/test_reasoning_content.py index 04e5160a7..d605a24f6 100644 --- a/test/srt/openai_server/features/test_reasoning_content.py +++ b/test/srt/openai_server/features/test_reasoning_content.py @@ -9,11 +9,9 @@ python3 -m unittest openai_server.features.test_reasoning_content.TestReasoningC python3 -m unittest openai_server.features.test_reasoning_content.TestReasoningContentStartup.test_streaming """ -import json import unittest import openai -import requests from sglang.srt.utils import kill_process_tree from sglang.test.test_utils import ( diff --git a/test/srt/openai_server/function_call/test_openai_function_calling.py b/test/srt/openai_server/function_call/test_openai_function_calling.py index fe5a49728..b54f90fc9 100644 --- a/test/srt/openai_server/function_call/test_openai_function_calling.py +++ b/test/srt/openai_server/function_call/test_openai_function_calling.py @@ -1,5 +1,4 @@ import json -import time import unittest import openai diff --git a/test/srt/quant/test_awq.py b/test/srt/quant/test_awq.py index c32b9f979..f6b74669c 100644 --- a/test/srt/quant/test_awq.py +++ b/test/srt/quant/test_awq.py @@ -1,8 +1,6 @@ import unittest from types import SimpleNamespace -import requests - from sglang.srt.utils import kill_process_tree from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( diff --git a/test/srt/quant/test_triton_scaled_mm.py b/test/srt/quant/test_triton_scaled_mm.py index dafde83be..72a0bbf31 100644 --- a/test/srt/quant/test_triton_scaled_mm.py +++ b/test/srt/quant/test_triton_scaled_mm.py @@ -1,4 +1,3 @@ -import itertools import unittest from typing import Optional diff --git a/test/srt/rl/test_update_weights_from_distributed.py b/test/srt/rl/test_update_weights_from_distributed.py index 37782c397..f2c6e5131 100644 --- a/test/srt/rl/test_update_weights_from_distributed.py +++ b/test/srt/rl/test_update_weights_from_distributed.py @@ -22,7 +22,6 @@ import unittest import numpy as np import requests import torch -import torch.distributed as dist import torch.multiprocessing as mp from transformers import AutoModelForCausalLM diff --git a/test/srt/rl/test_verl_engine_2_gpu.py b/test/srt/rl/test_verl_engine_2_gpu.py index 39b2e6887..fbd66f062 100644 --- a/test/srt/rl/test_verl_engine_2_gpu.py +++ b/test/srt/rl/test_verl_engine_2_gpu.py @@ -19,7 +19,6 @@ from torch.distributed.fsdp.api import ( from transformers import AutoModelForCausalLM from sglang.srt.entrypoints.verl_engine import VerlEngine -from sglang.srt.utils import is_port_available from sglang.srt.utils.hf_transformers_utils import get_tokenizer from sglang.test.runners import ( HFRunner, diff --git a/test/srt/rl/test_verl_engine_4_gpu.py b/test/srt/rl/test_verl_engine_4_gpu.py index fb137cab4..a6fce4f88 100644 --- a/test/srt/rl/test_verl_engine_4_gpu.py +++ b/test/srt/rl/test_verl_engine_4_gpu.py @@ -19,7 +19,6 @@ from torch.distributed.fsdp.api import ( from transformers import AutoModelForCausalLM from sglang.srt.entrypoints.verl_engine import VerlEngine -from sglang.srt.utils import is_port_available from sglang.srt.utils.hf_transformers_utils import get_tokenizer from sglang.test.runners import ( HFRunner, @@ -125,7 +124,7 @@ class TestVerlEngine(CustomTestCase): if is_in_ci(): return - for index, model_info in enumerate(ALL_OTHER_MODELS): + for index, model_info in enumerate(ALL_MODELS): self.assert_fragment_e2e_execution(index=index, **model_info) # def test_adhoc(self): diff --git a/test/srt/test_abort.py b/test/srt/test_abort.py index f50ab4037..94256e558 100644 --- a/test/srt/test_abort.py +++ b/test/srt/test_abort.py @@ -1,6 +1,4 @@ -import json import multiprocessing -import os import time import unittest from concurrent.futures import ThreadPoolExecutor, as_completed diff --git a/test/srt/test_async_dynamic_batch_tokenizer.py b/test/srt/test_async_dynamic_batch_tokenizer.py index 930e23e54..f5d50ab56 100644 --- a/test/srt/test_async_dynamic_batch_tokenizer.py +++ b/test/srt/test_async_dynamic_batch_tokenizer.py @@ -8,7 +8,7 @@ including batch efficiency, timeout handling, and error cases. import asyncio import logging import time -from unittest.mock import AsyncMock, Mock, patch +from unittest.mock import Mock import pytest from transformers import AutoTokenizer diff --git a/test/srt/test_bench_one_batch.py b/test/srt/test_bench_one_batch.py index 7ec33a559..8d14cd0b7 100644 --- a/test/srt/test_bench_one_batch.py +++ b/test/srt/test_bench_one_batch.py @@ -1,4 +1,3 @@ -import os import unittest from sglang.test.test_utils import ( diff --git a/test/srt/test_bench_serving.py b/test/srt/test_bench_serving.py index 747794609..d78c16ba8 100644 --- a/test/srt/test_bench_serving.py +++ b/test/srt/test_bench_serving.py @@ -4,7 +4,6 @@ import unittest import requests -from sglang.srt.utils.hf_transformers_utils import get_tokenizer from sglang.test.test_utils import ( DEFAULT_EAGLE_DRAFT_MODEL_FOR_TEST, DEFAULT_EAGLE_TARGET_MODEL_FOR_TEST, diff --git a/test/srt/test_bnb.py b/test/srt/test_bnb.py index 4505b20cf..4328d56be 100644 --- a/test/srt/test_bnb.py +++ b/test/srt/test_bnb.py @@ -4,19 +4,12 @@ python3 -m unittest test_bnb.TestVisionModel.test_vlm python3 -m unittest test_bnb.TestLanguageModel.test_mmlu """ -import io -import json import multiprocessing as mp -import os -import unittest +import random from concurrent.futures import ThreadPoolExecutor from types import SimpleNamespace -import numpy as np import openai -import pybase64 -import requests -from PIL import Image from sglang.srt.utils import kill_process_tree from sglang.test.run_eval import run_eval diff --git a/test/srt/test_config_integration.py b/test/srt/test_config_integration.py index ea13b8d6c..6b3992c89 100644 --- a/test/srt/test_config_integration.py +++ b/test/srt/test_config_integration.py @@ -4,7 +4,6 @@ Test script to verify SGLang config file integration. import os import tempfile -from pathlib import Path import pytest import yaml diff --git a/test/srt/test_cpp_radix_cache.py b/test/srt/test_cpp_radix_cache.py index 2e6baa653..b2146beaf 100644 --- a/test/srt/test_cpp_radix_cache.py +++ b/test/srt/test_cpp_radix_cache.py @@ -1,4 +1,3 @@ -import os import unittest from types import SimpleNamespace diff --git a/test/srt/test_create_kvindices.py b/test/srt/test_create_kvindices.py index 4196eb290..7e63fd823 100644 --- a/test/srt/test_create_kvindices.py +++ b/test/srt/test_create_kvindices.py @@ -1,4 +1,3 @@ -import itertools import unittest import numpy as np diff --git a/test/srt/test_deepseek_chat_templates.py b/test/srt/test_deepseek_chat_templates.py index 6c56816c8..a2c1c8ecd 100644 --- a/test/srt/test_deepseek_chat_templates.py +++ b/test/srt/test_deepseek_chat_templates.py @@ -6,7 +6,6 @@ both dict and string types for tool['function']['arguments'] without double-esca addressing issue #11700. """ -import json import os import unittest diff --git a/test/srt/test_deepseek_v32_nsabackend.py b/test/srt/test_deepseek_v32_nsabackend.py index cd7702f28..205983ab3 100644 --- a/test/srt/test_deepseek_v32_nsabackend.py +++ b/test/srt/test_deepseek_v32_nsabackend.py @@ -3,7 +3,6 @@ from types import SimpleNamespace from sglang.srt.utils import kill_process_tree from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k -from sglang.test.send_one import BenchArgs, send_one_prompt from sglang.test.test_utils import ( DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, diff --git a/test/srt/test_deepseek_v3_basic.py b/test/srt/test_deepseek_v3_basic.py index 989192e19..e8c4b2d08 100644 --- a/test/srt/test_deepseek_v3_basic.py +++ b/test/srt/test_deepseek_v3_basic.py @@ -1,8 +1,6 @@ import unittest from types import SimpleNamespace -import requests - from sglang.srt.utils import kill_process_tree from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.send_one import BenchArgs, send_one_prompt diff --git a/test/srt/test_deepseek_v3_cutedsl_4gpu.py b/test/srt/test_deepseek_v3_cutedsl_4gpu.py index a72a19027..260575ef0 100644 --- a/test/srt/test_deepseek_v3_cutedsl_4gpu.py +++ b/test/srt/test_deepseek_v3_cutedsl_4gpu.py @@ -2,8 +2,6 @@ import os import unittest from types import SimpleNamespace -import requests - from sglang.srt.utils import kill_process_tree from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.test_utils import ( diff --git a/test/srt/test_deterministic.py b/test/srt/test_deterministic.py index f0fcc426b..4d6c8e608 100644 --- a/test/srt/test_deterministic.py +++ b/test/srt/test_deterministic.py @@ -9,19 +9,10 @@ test into unit tests so that's easily reproducible in CI. import unittest -from sglang.srt.utils import kill_process_tree -from sglang.test.test_deterministic import BenchArgs, test_deterministic from sglang.test.test_deterministic_utils import ( COMMON_SERVER_ARGS, - DEFAULT_MODEL, TestDeterministicBase, ) -from sglang.test.test_utils import ( - DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, - DEFAULT_URL_FOR_TEST, - CustomTestCase, - popen_launch_server, -) class TestFlashinferDeterministic(TestDeterministicBase): diff --git a/test/srt/test_disaggregation_hybrid_attention.py b/test/srt/test_disaggregation_hybrid_attention.py index 34ed29c72..83ebed93f 100644 --- a/test/srt/test_disaggregation_hybrid_attention.py +++ b/test/srt/test_disaggregation_hybrid_attention.py @@ -1,8 +1,6 @@ -import os import unittest from types import SimpleNamespace -from sglang.srt.environ import envs from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.test_disaggregation_utils import TestDisaggregationBase from sglang.test.test_utils import ( diff --git a/test/srt/test_eval_accuracy_large.py b/test/srt/test_eval_accuracy_large.py index 99304dfde..efb202463 100644 --- a/test/srt/test_eval_accuracy_large.py +++ b/test/srt/test_eval_accuracy_large.py @@ -3,8 +3,6 @@ Usage: python -m unittest test_eval_accuracy_large.TestEvalAccuracyLarge.test_mmlu """ -import os -import time import unittest from types import SimpleNamespace diff --git a/test/srt/test_expert_distribution.py b/test/srt/test_expert_distribution.py index aeb989941..c3ebd0762 100755 --- a/test/srt/test_expert_distribution.py +++ b/test/srt/test_expert_distribution.py @@ -1,4 +1,3 @@ -import os import tempfile import unittest from pathlib import Path diff --git a/test/srt/test_flash_attention_4.py b/test/srt/test_flash_attention_4.py index 2be593b4a..4322263c4 100644 --- a/test/srt/test_flash_attention_4.py +++ b/test/srt/test_flash_attention_4.py @@ -1,7 +1,6 @@ import unittest from types import SimpleNamespace -from sglang.srt.environ import envs from sglang.srt.utils import get_device_sm, kill_process_tree from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.test_utils import ( diff --git a/test/srt/test_flashmla.py b/test/srt/test_flashmla.py index 07d19f9f9..e9c69e5d5 100644 --- a/test/srt/test_flashmla.py +++ b/test/srt/test_flashmla.py @@ -11,15 +11,12 @@ import torch from sglang.srt.utils import kill_process_tree from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k -from sglang.test.send_one import BenchArgs, send_one_prompt from sglang.test.test_utils import ( DEFAULT_MODEL_NAME_FOR_TEST_MLA, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_URL_FOR_TEST, CustomTestCase, - is_in_ci, popen_launch_server, - write_github_step_summary, ) diff --git a/test/srt/test_fp4_moe.py b/test/srt/test_fp4_moe.py index ac42fa860..306a331fe 100644 --- a/test/srt/test_fp4_moe.py +++ b/test/srt/test_fp4_moe.py @@ -5,12 +5,11 @@ import pytest import torch from flashinfer import fp4_quantize, scaled_fp4_grouped_quantize from flashinfer.fused_moe import cutlass_fused_moe as flashinfer_cutlass_fused_moe -from sgl_kernel import scaled_fp4_quant +from sgl_kernel import scaled_fp4_quant, silu_and_mul from torch.nn import functional as F from sglang.srt.layers.moe.cutlass_moe import cutlass_moe_fp4 from sglang.srt.layers.moe.cutlass_moe_params import CutlassMoEParams, CutlassMoEType -from sglang.srt.layers.moe.flashinfer_cutedsl_moe import flashinfer_cutedsl_moe_masked from sglang.srt.layers.moe.topk import TopKConfig, select_experts if torch.cuda.get_device_capability() < (10, 0): diff --git a/test/srt/test_function_call_parser.py b/test/srt/test_function_call_parser.py index 2fcd28ea2..12f26982a 100644 --- a/test/srt/test_function_call_parser.py +++ b/test/srt/test_function_call_parser.py @@ -12,9 +12,6 @@ from sglang.srt.function_call.llama32_detector import Llama32Detector from sglang.srt.function_call.mistral_detector import MistralDetector from sglang.srt.function_call.pythonic_detector import PythonicDetector from sglang.srt.function_call.qwen3_coder_detector import Qwen3CoderDetector -from sglang.srt.function_call.qwen25_detector import Qwen25Detector -from sglang.srt.utils.hf_transformers_utils import get_tokenizer -from sglang.test.test_utils import DEFAULT_SMALL_MODEL_NAME_FOR_TEST class TestPythonicDetector(unittest.TestCase): diff --git a/test/srt/test_fused_moe.py b/test/srt/test_fused_moe.py index 57b2f944b..65d35c59a 100644 --- a/test/srt/test_fused_moe.py +++ b/test/srt/test_fused_moe.py @@ -1,7 +1,6 @@ import unittest import torch -import torch.nn.functional as F from tqdm import tqdm from sglang.srt.layers.activation import SiluAndMul diff --git a/test/srt/test_hybrid_attn_backend.py b/test/srt/test_hybrid_attn_backend.py index e43158a2e..a16203ae7 100644 --- a/test/srt/test_hybrid_attn_backend.py +++ b/test/srt/test_hybrid_attn_backend.py @@ -1,4 +1,3 @@ -import os import unittest from types import SimpleNamespace diff --git a/test/srt/test_kv_events.py b/test/srt/test_kv_events.py index d333738c7..601831d03 100644 --- a/test/srt/test_kv_events.py +++ b/test/srt/test_kv_events.py @@ -1,7 +1,6 @@ import time import unittest -import msgspec import requests import zmq from msgspec.msgpack import Decoder @@ -10,8 +9,6 @@ from sglang.srt.disaggregation.kv_events import ( AllBlocksCleared, BlockRemoved, BlockStored, - EventBatch, - KVCacheEvent, KVEventBatch, ) from sglang.srt.utils import kill_process_tree diff --git a/test/srt/test_load_weights_from_remote_instance.py b/test/srt/test_load_weights_from_remote_instance.py index 71ab24d1d..bd722a920 100644 --- a/test/srt/test_load_weights_from_remote_instance.py +++ b/test/srt/test_load_weights_from_remote_instance.py @@ -21,7 +21,6 @@ import unittest import numpy as np import requests import torch -import torch.distributed as dist import torch.multiprocessing as mp import sglang as sgl diff --git a/test/srt/test_mamba_unittest.py b/test/srt/test_mamba_unittest.py index 7bbca75e1..ab6b5436d 100644 --- a/test/srt/test_mamba_unittest.py +++ b/test/srt/test_mamba_unittest.py @@ -1,4 +1,3 @@ -import inspect import os import unittest diff --git a/test/srt/test_modelopt_export.py b/test/srt/test_modelopt_export.py index eb518f585..aa477ff67 100644 --- a/test/srt/test_modelopt_export.py +++ b/test/srt/test_modelopt_export.py @@ -7,7 +7,6 @@ and quantization workflow. import json import os -import sys import tempfile import unittest from unittest.mock import Mock, patch @@ -23,7 +22,7 @@ from sglang.srt.model_loader.loader import ModelOptModelLoader # Check if modelopt is available try: - import modelopt + import modelopt # noqa: F401 MODELOPT_AVAILABLE = True except ImportError: diff --git a/test/srt/test_modelopt_loader.py b/test/srt/test_modelopt_loader.py index f137318f0..a2bad70b5 100644 --- a/test/srt/test_modelopt_loader.py +++ b/test/srt/test_modelopt_loader.py @@ -5,8 +5,6 @@ This test module verifies the functionality of ModelOptModelLoader, which applies NVIDIA Model Optimizer quantization to models during loading. """ -import os -import sys import unittest from unittest.mock import MagicMock, patch diff --git a/test/srt/test_mscclpp.py b/test/srt/test_mscclpp.py index 894598b3d..c30dbe00d 100644 --- a/test/srt/test_mscclpp.py +++ b/test/srt/test_mscclpp.py @@ -8,28 +8,20 @@ else fi """ -import itertools import os import random import socket import unittest -from contextlib import contextmanager, nullcontext -from typing import Any, List, Optional, Union +from typing import Any import ray import torch import torch.distributed as dist -from torch.distributed import ProcessGroup, ReduceOp from sglang.srt.distributed import init_distributed_environment from sglang.srt.distributed.communication_op import ( # noqa tensor_model_parallel_all_reduce, ) -from sglang.srt.distributed.device_communicators.custom_all_reduce import ( - CustomAllreduce, -) -from sglang.srt.distributed.device_communicators.pymscclpp import PyMscclppCommunicator -from sglang.srt.distributed.device_communicators.pynccl import PyNcclCommunicator from sglang.srt.distributed.parallel_state import ( get_tensor_model_parallel_group, graph_capture, @@ -37,7 +29,6 @@ from sglang.srt.distributed.parallel_state import ( set_custom_all_reduce, set_mscclpp_all_reduce, ) -from sglang.srt.distributed.utils import StatelessProcessGroup from sglang.test.test_utils import CustomTestCase diff --git a/test/srt/test_multi_tokenizer.py b/test/srt/test_multi_tokenizer.py index 182454e5e..f705c061c 100644 --- a/test/srt/test_multi_tokenizer.py +++ b/test/srt/test_multi_tokenizer.py @@ -1,7 +1,6 @@ import unittest from types import SimpleNamespace -import sglang.srt.managers.io_struct as io_struct from sglang.srt.utils import kill_process_tree from sglang.test.run_eval import run_eval from sglang.test.test_utils import ( diff --git a/test/srt/test_original_logprobs.py b/test/srt/test_original_logprobs.py index 1a50e3aa6..81ed0a403 100644 --- a/test/srt/test_original_logprobs.py +++ b/test/srt/test_original_logprobs.py @@ -17,7 +17,6 @@ import os import random import unittest -import numpy as np import torch import torch.nn.functional as F from transformers import AutoModelForCausalLM, AutoTokenizer diff --git a/test/srt/test_priority_scheduling.py b/test/srt/test_priority_scheduling.py index befde130e..ef79188f8 100644 --- a/test/srt/test_priority_scheduling.py +++ b/test/srt/test_priority_scheduling.py @@ -2,7 +2,7 @@ import asyncio import os import re import unittest -from typing import Any, Awaitable, Callable, List, Optional, Tuple +from typing import Any, List, Optional, Tuple from sglang.srt.utils import kill_process_tree from sglang.test.test_utils import ( diff --git a/test/srt/test_quantization.py b/test/srt/test_quantization.py index 990378d9b..3ce4a5ee9 100644 --- a/test/srt/test_quantization.py +++ b/test/srt/test_quantization.py @@ -1,8 +1,6 @@ import json -import os import unittest import warnings -from datetime import datetime from types import SimpleNamespace from sglang.srt.utils import kill_process_tree diff --git a/test/srt/test_schedule_policy.py b/test/srt/test_schedule_policy.py index 0e33b6b25..2be092e31 100644 --- a/test/srt/test_schedule_policy.py +++ b/test/srt/test_schedule_policy.py @@ -6,7 +6,7 @@ from sglang.srt.managers.schedule_policy import ( CacheAwarePolicy, SchedulePolicy, ) -from sglang.srt.mem_cache.radix_cache import RadixCache, TreeNode +from sglang.srt.mem_cache.radix_cache import RadixCache from sglang.srt.sampling.sampling_params import SamplingParams from sglang.test.test_utils import CustomTestCase diff --git a/test/srt/test_tokenizer_batch_encode.py b/test/srt/test_tokenizer_batch_encode.py index 13d294d68..8d6e7539d 100644 --- a/test/srt/test_tokenizer_batch_encode.py +++ b/test/srt/test_tokenizer_batch_encode.py @@ -10,12 +10,10 @@ python3 -m unittest test_tokenizer_batch_encode.TestTokenizerBatchEncodeUnit.tes python3 -m unittest test_tokenizer_batch_encode.TestTokenizerBatchEncodeLogic.test_batch_processing_path """ -import asyncio import unittest -from typing import List -from unittest.mock import AsyncMock, Mock, call, patch +from unittest.mock import Mock, patch -from sglang.srt.managers.io_struct import GenerateReqInput, TokenizedGenerateReqInput +from sglang.srt.managers.io_struct import GenerateReqInput from sglang.srt.managers.tokenizer_manager import TokenizerManager from sglang.srt.server_args import PortArgs, ServerArgs from sglang.test.test_utils import DEFAULT_SMALL_MODEL_NAME_FOR_TEST diff --git a/test/srt/test_tokenizer_manager.py b/test/srt/test_tokenizer_manager.py index d1817e6d9..04115fb99 100644 --- a/test/srt/test_tokenizer_manager.py +++ b/test/srt/test_tokenizer_manager.py @@ -12,7 +12,6 @@ python3 -m unittest test_tokenizer_manager.TestTokenizerManagerIntegration """ import unittest -from typing import List, Optional, Union from unittest.mock import Mock, patch from sglang.srt.managers.tokenizer_manager import TokenizerManager diff --git a/test/srt/test_tracing.py b/test/srt/test_tracing.py index 173b15b50..4e3763ac4 100644 --- a/test/srt/test_tracing.py +++ b/test/srt/test_tracing.py @@ -10,7 +10,6 @@ import requests import zmq from sglang import Engine -from sglang.srt.managers.io_struct import TokenizedGenerateReqInput from sglang.srt.tracing.trace import * from sglang.srt.utils import get_zmq_socket, kill_process_tree from sglang.test.test_utils import ( diff --git a/test/srt/test_triton_fused_moe.py b/test/srt/test_triton_fused_moe.py index f9b1ee884..d989494c9 100644 --- a/test/srt/test_triton_fused_moe.py +++ b/test/srt/test_triton_fused_moe.py @@ -1,7 +1,6 @@ import unittest import torch -import torch.nn.functional as F from tqdm import tqdm from sglang.srt.layers.activation import SiluAndMul diff --git a/test/srt/test_vision_openai_server_a.py b/test/srt/test_vision_openai_server_a.py index 2f727ecc1..7f8cc87b5 100644 --- a/test/srt/test_vision_openai_server_a.py +++ b/test/srt/test_vision_openai_server_a.py @@ -207,11 +207,12 @@ class TestDeepseekOCRServer(TestOpenAIMLLMServerBase): if __name__ == "__main__": - del ( - TestOpenAIMLLMServerBase, - ImageOpenAITestMixin, - VideoOpenAITestMixin, - AudioOpenAITestMixin, - OmniOpenAITestMixin, - ) + # Note: Cannot delete mixin classes imported via * since they're not in local scope + # del ( + # TestOpenAIMLLMServerBase, + # ImageOpenAITestMixin, + # VideoOpenAITestMixin, + # AudioOpenAITestMixin, + # OmniOpenAITestMixin, + # ) unittest.main() diff --git a/test/srt/test_vlm_input_format.py b/test/srt/test_vlm_input_format.py index cc2ebcb3a..489f9cbba 100644 --- a/test/srt/test_vlm_input_format.py +++ b/test/srt/test_vlm_input_format.py @@ -7,7 +7,6 @@ import requests import torch from PIL import Image from transformers import ( - AutoModel, AutoProcessor, Gemma3ForConditionalGeneration, Qwen2_5_VLForConditionalGeneration, diff --git a/test/srt/xpu/test_intel_xpu_backend.py b/test/srt/xpu/test_intel_xpu_backend.py index a0f301617..701769e75 100644 --- a/test/srt/xpu/test_intel_xpu_backend.py +++ b/test/srt/xpu/test_intel_xpu_backend.py @@ -3,7 +3,6 @@ Usage: python3 -m unittest test_intel_xpu_backend.TestIntelXPUBackend.test_latency_qwen_model """ -import os import unittest from functools import wraps