Skip to content

Commit

Permalink
Address py38/39 incompatibilities (#261)
Browse files Browse the repository at this point in the history
**SUMMARY**

Handle a few different Python 3.8/3.9 compatibility issues:
* Fix the Python 3.8 compatibility in one of our benchmarking scripts.
* Fix skip for `test_local_workers_clean_shutdown` (previous skip
attempt misused `pytest.mark.skipif`)
* Skip `test_merge_async_iterators` (uses Python builtin `anext` which
was added in 3.10)
  • Loading branch information
dbarbuzzi committed May 28, 2024
1 parent a6b9443 commit e168417
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions neuralmagic/benchmarks/run_benchmark_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import subprocess
import time
from pathlib import Path
from typing import NamedTuple, Optional
from typing import List, NamedTuple, Optional

import requests

Expand Down Expand Up @@ -62,7 +62,7 @@ def run_benchmark_serving_script(config: NamedTuple,
) -> None:
assert config.script_name == 'benchmark_serving'

def run_bench(server_cmd: str, bench_cmd: list[str], model: str) -> None:
def run_bench(server_cmd: str, bench_cmd: List[str], model: str) -> None:
try:
# start server
server_process = subprocess.Popen("exec " + server_cmd, shell=True)
Expand Down
5 changes: 5 additions & 0 deletions tests/async_engine/test_merge_async_iterators.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import asyncio
# UPSTREAM SYNC
import sys
from typing import AsyncIterator, Tuple

import pytest

from vllm.utils import merge_async_iterators


# UPSTREAM SYNC
@pytest.mark.skipif(sys.version_info < (3, 10),
reason="`anext` requires Python 3.10")
@pytest.mark.asyncio
async def test_merge_async_iterators():

Expand Down
7 changes: 0 additions & 7 deletions tests/engine/test_multiproc_workers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import asyncio
# UPSTREAM SYNC
import sys
from concurrent.futures import ThreadPoolExecutor
from functools import partial
from time import sleep
Expand Down Expand Up @@ -102,11 +100,6 @@ def execute_workers(worker_input: str) -> None:
def test_local_workers_clean_shutdown() -> None:
"""Test clean shutdown"""

# UPSTREAM SYNC
pytest.mark.skipif(sys.version_info < (3, 10),
reason="This test is inexplicably failing in CI "
"on Python < 3.10")

workers, worker_monitor = _start_workers()

assert worker_monitor.is_alive()
Expand Down

0 comments on commit e168417

Please sign in to comment.