[Refactor][CI] Reorganize test tree, and move slow e2e to weekly (#4951)

Signed-off-by: wangyu <410167048@qq.com>
This commit is contained in:
wangyu authored and GitHub committed 2026-07-29 23:53:03 +08:00
1 parent 925347332f
commit 7c17111ff5
158 files changed
+3479 -4130

No files matched your search

@@ -0,0 +1,100 @@
"""Tests for speaker metadata (created_at, consent, ref_text, ...) round-tripping
through the safetensors header.
These cover the helpers that back ``_restore_uploaded_speakers`` — the logic
that rebuilds ``uploaded_speakers`` on server start by reading the
``.safetensors`` file written during upload.
"""
import pytest
from vllm_omni.entrypoints.openai.serving_speech import OmniOpenAIServingSpeech
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
class TestSpeakerMetadataRoundTrip:
def test_str_only_header(self):
"""The safetensors metadata dict must be ``dict[str, str]`` — every value
serialized as a string (ints and None handled)."""
data = {
"name": "Alice",
"voice_name_lower": "alice",
"consent": "xxx",
"created_at": 1712345678,
"sample_rate": 24000,
"embedding_source": "audio",
"ref_text": None, # None values must be dropped
"file_path": "/tmp/should/be/stripped.safetensors", # re-derived, not persisted
}
header = OmniOpenAIServingSpeech._speaker_metadata_to_header(data)
assert all(isinstance(k, str) and isinstance(v, str) for k, v in header.items())
assert "ref_text" not in header # None stripped
assert "file_path" not in header # never persisted
def test_int_fields_coerce_back(self):
"""Int fields (created_at, file_size, sample_rate, embedding_dim) survive
the string round-trip with their type preserved."""
data = {
"name": "Bob",
"voice_name_lower": "bob",
"consent": "yyy",
"created_at": 1712345678,
"sample_rate": 44100,
"file_size": 12345,
"embedding_dim": 1024,
"embedding_source": "direct",
}
header = OmniOpenAIServingSpeech._speaker_metadata_to_header(data)
back = OmniOpenAIServingSpeech._speaker_metadata_from_header(header, "/some/path.safetensors")
assert isinstance(back["created_at"], int)
assert back["created_at"] == 1712345678
assert isinstance(back["sample_rate"], int)
assert back["sample_rate"] == 44100
assert isinstance(back["file_size"], int)
assert isinstance(back["embedding_dim"], int)
def test_file_path_reinjected_on_load(self):
"""file_path is not persisted in the header; restore derives it from the
actual file location on disk."""
data = {
"name": "Carol",
"voice_name_lower": "carol",
"consent": "zzz",
"created_at": 1234,
"embedding_source": "audio",
}
header = OmniOpenAIServingSpeech._speaker_metadata_to_header(data)
back = OmniOpenAIServingSpeech._speaker_metadata_from_header(header, "/real/path.safetensors")
assert back["file_path"] == "/real/path.safetensors"
def test_string_fields_preserved(self):
"""ref_text, consent, speaker_description must survive unchanged."""
data = {
"name": "Dave",
"voice_name_lower": "dave",
"consent": "consent-id-42",
"created_at": 1,
"ref_text": "Hello. This is a transcript with punctuation!",
"speaker_description": "A warm baritone voice.",
"embedding_source": "audio",
}
header = OmniOpenAIServingSpeech._speaker_metadata_to_header(data)
back = OmniOpenAIServingSpeech._speaker_metadata_from_header(header, "/x.safetensors")
assert back["ref_text"] == data["ref_text"]
assert back["speaker_description"] == data["speaker_description"]
assert back["consent"] == data["consent"]
def test_malformed_int_is_left_as_string(self):
"""If an int field somehow contains non-numeric text (manual edit,
corruption), the loader does not crash; it leaves the field as-is."""
header = {
"name": "Eve",
"voice_name_lower": "eve",
"consent": "x",
"created_at": "not-a-number",
"embedding_source": "audio",
}
back = OmniOpenAIServingSpeech._speaker_metadata_from_header(header, "/p.safetensors")
# Preserved as string rather than raising.
assert back["created_at"] == "not-a-number"
@@ -16,6 +16,8 @@ from vllm_omni.entrypoints.openai.speech_usage import (
qwen3_tts_input_token_details,
)
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
# A deterministic stand-in for a real tokenizer: 1 token per whitespace word.
def word_count(text: str) -> int:
@@ -3,6 +3,7 @@
from types import SimpleNamespace
import pytest
from vllm import SamplingParams
from vllm_omni.entrypoints.openai.stage_params import (
@@ -12,6 +13,8 @@ from vllm_omni.entrypoints.openai.stage_params import (
)
from vllm_omni.inputs.data import OmniDiffusionSamplingParams
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
def test_resolve_stage_sampling_params_clones_stage_default():
default = SamplingParams(temperature=0.2, seed=11)
@@ -15,6 +15,9 @@ from vllm_omni.entrypoints.openai.tts_adapters import (
)
from vllm_omni.entrypoints.openai.tts_adapters.qwen3_tts import Qwen3TTSAdapter
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
# Every dedicated TTS model-type must have an adapter so the orchestrator's
# uniform ``self._adapter.build(...)`` dispatch covers it.
EXPECTED_MODEL_TYPES = {
@@ -12,6 +12,8 @@ from tests.entrypoints.openai_api.conftest_video import (
)
from vllm_omni.entrypoints.openai.video_frame_filter import FrameSimilarityFilter
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
class TestFrameSimilarityFilter:
def test_first_frame_always_retained(self):
@@ -22,6 +22,9 @@ from vllm_omni.entrypoints.openai.video_stream_session import (
VideoStreamHandler,
)
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------
@@ -15,6 +15,9 @@ from vllm_omni.entrypoints.openai.video_stream_session import (
VideoStreamSession,
)
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
# ---------------------------------------------------------------------------
# VideoStreamConfig
# ---------------------------------------------------------------------------