conftest.py 603 Bytes
Newer Older
1
import sys
Keyang Ru's avatar
Keyang Ru committed
2
from importlib.util import find_spec
3
4
from pathlib import Path

Keyang Ru's avatar
Keyang Ru committed
5
6
# Only add py_src to path if the wheel is not installed (for local development)
# This ensures CI tests use the installed wheel which contains the Rust extension
7
8
_ROOT = Path(__file__).resolve().parents[1]
_SRC = _ROOT / "py_src"
Keyang Ru's avatar
Keyang Ru committed
9
10
11
12
13
14

# Check if sglang_router is already installed with the Rust extension
_wheel_installed = find_spec("sglang_router.sglang_router_rs") is not None

# Only add py_src if wheel is not installed (development mode)
if not _wheel_installed and str(_SRC) not in sys.path:
15
    sys.path.insert(0, str(_SRC))