fix(e2e_test): remove dead code and fix type annotations (#16661)

This commit is contained in:
Simo Lin
2026-01-07 06:35:15 -08:00
committed by GitHub
parent e432057381
commit 8729ad5e6c
3 changed files with 8 additions and 46 deletions
+5 -5
View File
@@ -95,7 +95,7 @@ import subprocess
import sys import sys
from importlib.util import find_spec from importlib.util import find_spec
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, Any
import pytest import pytest
@@ -660,8 +660,8 @@ def _get_marker_value(
request: pytest.FixtureRequest, request: pytest.FixtureRequest,
marker_name: str, marker_name: str,
arg_index: int = 0, arg_index: int = 0,
default: any = None, default: Any = None,
) -> any: ) -> Any:
"""Get a value from a pytest marker. """Get a value from a pytest marker.
Args: Args:
@@ -684,8 +684,8 @@ def _get_marker_value(
def _get_marker_kwargs( def _get_marker_kwargs(
request: pytest.FixtureRequest, request: pytest.FixtureRequest,
marker_name: str, marker_name: str,
defaults: dict[str, any] | None = None, defaults: dict[str, Any] | None = None,
) -> dict[str, any]: ) -> dict[str, Any]:
"""Get keyword arguments from a pytest marker. """Get keyword arguments from a pytest marker.
Args: Args:
@@ -442,7 +442,7 @@ def make_report(eval_result: EvalResult) -> str:
) )
def make_report_from_example_htmls(htmls: List[str]): def make_report_from_example_htmls(htmls: list[str]):
""" """
Create a standalone HTML report from a list of example htmls Create a standalone HTML report from a list of example htmls
""" """
+2 -40
View File
@@ -36,21 +36,6 @@ from infra.model_specs import ( # noqa: F401; Default model paths
_resolve_model_path, _resolve_model_path,
) )
# =============================================================================
# Constants
# =============================================================================
# Server startup timeout (seconds)
DEFAULT_TIMEOUT = 600
DEFAULT_STARTUP_TIMEOUT = 300
# Default test port range
DEFAULT_PORT_BASE = 20000
# File paths for test output
STDOUT_FILENAME = "/tmp/sglang_test_stdout.txt"
STDERR_FILENAME = "/tmp/sglang_test_stderr.txt"
# ============================================================================= # =============================================================================
# Tokenizer Utilities # Tokenizer Utilities
# ============================================================================= # =============================================================================
@@ -194,28 +179,5 @@ def is_ci_environment() -> bool:
def get_test_timeout() -> int: def get_test_timeout() -> int:
"""Get test timeout from environment or default.""" """Get test timeout from environment or default (600 seconds)."""
return int(os.environ.get("E2E_TEST_TIMEOUT", str(DEFAULT_TIMEOUT))) return int(os.environ.get("E2E_TEST_TIMEOUT", "600"))
def skip_if_no_gpu():
"""Skip test if no GPU is available."""
import pytest
try:
import torch
if not torch.cuda.is_available():
pytest.skip("No GPU available")
except ImportError:
# Try nvidia-ml-py
try:
import pynvml
pynvml.nvmlInit()
count = pynvml.nvmlDeviceGetCount()
pynvml.nvmlShutdown()
if count == 0:
pytest.skip("No GPU available")
except Exception:
pytest.skip("Cannot detect GPU (torch and pynvml not available)")