mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 05:04:58 +08:00
Signed-off-by: dongbo910220 <1275604947@qq.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
20 lines
546 B
Python
20 lines
546 B
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
|
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
from vllm.utils.system_utils import unique_filepath
|
|
|
|
|
|
def test_unique_filepath():
|
|
temp_dir = tempfile.mkdtemp()
|
|
path_fn = lambda i: Path(temp_dir) / f"file_{i}.txt"
|
|
paths = set()
|
|
for i in range(10):
|
|
path = unique_filepath(path_fn)
|
|
path.write_text("test")
|
|
paths.add(path)
|
|
assert len(paths) == 10
|
|
assert len(list(Path(temp_dir).glob("*.txt"))) == 10
|