[mypy] Enable type checking for test directory (#5017)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import multiprocessing
|
||||
import os
|
||||
from typing import Dict, List
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
@@ -17,9 +18,9 @@ from vllm.utils import update_environment_variables
|
||||
|
||||
def distributed_run(fn, world_size):
|
||||
number_of_processes = world_size
|
||||
processes = []
|
||||
processes: List[multiprocessing.Process] = []
|
||||
for i in range(number_of_processes):
|
||||
env = {}
|
||||
env: Dict[str, str] = {}
|
||||
env['RANK'] = str(i)
|
||||
env['LOCAL_RANK'] = str(i)
|
||||
env['WORLD_SIZE'] = str(number_of_processes)
|
||||
|
||||
@@ -6,7 +6,7 @@ from vllm.utils import cuda_device_count_stateless
|
||||
|
||||
|
||||
@ray.remote
|
||||
class _CUDADeviceCountStatelessTestActor():
|
||||
class _CUDADeviceCountStatelessTestActor:
|
||||
|
||||
def get_count(self):
|
||||
return cuda_device_count_stateless()
|
||||
@@ -22,7 +22,8 @@ def test_cuda_device_count_stateless():
|
||||
"""Test that cuda_device_count_stateless changes return value if
|
||||
CUDA_VISIBLE_DEVICES is changed."""
|
||||
|
||||
actor = _CUDADeviceCountStatelessTestActor.options(num_gpus=2).remote()
|
||||
actor = _CUDADeviceCountStatelessTestActor.options( # type: ignore
|
||||
num_gpus=2).remote()
|
||||
assert sorted(ray.get(
|
||||
actor.get_cuda_visible_devices.remote()).split(",")) == ["0", "1"]
|
||||
assert ray.get(actor.get_count.remote()) == 2
|
||||
|
||||
Reference in New Issue
Block a user