From 0618408bc3d588d129a2ecfb668b6fd330908092 Mon Sep 17 00:00:00 2001 From: moran Date: Fri, 7 Nov 2025 11:35:28 +0800 Subject: [PATCH] set mf env in global test env --- tests/st/__init__.py | 5 +++++ tests/st/python/cases_parallel/multilora_inference.py | 4 +--- tests/st/python/cases_parallel/shm_broadcast.py | 6 +----- .../python/cases_parallel/vllm_deepseek_bf16_part.py | 4 +--- .../cases_parallel/vllm_deepseek_bf16_part_v1.py | 4 +--- tests/st/python/cases_parallel/vllm_deepseek_osl.py | 4 +--- tests/st/python/cases_parallel/vllm_deepseek_part.py | 4 +--- .../st/python/cases_parallel/vllm_deepseek_part_v1.py | 4 +--- .../python/cases_parallel/vllm_deepseek_smoothquant.py | 4 +--- .../cases_parallel/vllm_deepseek_smoothquant_mss.py | 4 +--- tests/st/python/cases_parallel/vllm_llama3.py | 9 ++++++--- tests/st/python/cases_parallel/vllm_mf_qwen3_8b.py | 4 +--- tests/st/python/cases_parallel/vllm_mf_qwen_7b.py | 4 +--- .../cases_parallel/vllm_mf_qwen_7b_chunk_prefill.py | 4 +--- .../cases_parallel/vllm_mf_qwen_7b_chunk_prefill_v1.py | 4 +--- .../python/cases_parallel/vllm_mf_qwen_7b_cp_pc_mss.py | 4 +--- tests/st/python/cases_parallel/vllm_mf_qwen_7b_mss.py | 4 +--- .../cases_parallel/vllm_mf_qwen_7b_prefix_caching.py | 4 +--- .../vllm_mf_qwen_7b_prefix_caching_v1.py | 4 +--- tests/st/python/cases_parallel/vllm_mf_qwen_7b_v1.py | 4 +--- tests/st/python/cases_parallel/vllm_mf_telechat2_7b.py | 4 +--- .../st/python/cases_parallel/vllm_qwen2_5_vl_7b_v1.py | 4 +--- tests/st/python/cases_parallel/vllm_qwen3.py | 4 +--- tests/st/python/cases_parallel/vllm_qwen3_moe.py | 4 +--- tests/st/python/cases_parallel/vllm_qwen_7b.py | 4 +--- tests/st/python/cases_parallel/vllm_qwen_7b_v1.py | 4 +--- tests/st/python/cases_parallel/vllm_sampling.py | 4 +--- tests/st/python/cell/test_attention.py | 7 +++++++ tests/st/python/cell/test_smooth_quant.py | 7 +++++++ tests/st/python/test_custom_advstepflash.py | 1 + tests/st/python/test_deepseekv3_tool_parser.py | 7 +++++++ tests/st/python/test_ds_online.py | 10 +++++++--- tests/st/python/test_mcore_mix_parallel.py | 4 +--- tests/st/python/test_sampler.py | 1 + tests/st/python/test_sampler_v1.py | 1 + 35 files changed, 68 insertions(+), 86 deletions(-) diff --git a/tests/st/__init__.py b/tests/st/__init__.py index e69de29bb..bec7616c8 100644 --- a/tests/st/__init__.py +++ b/tests/st/__init__.py @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 +from tests.st.python.utils.env_var_manager import EnvVarManager + +env_manager = EnvVarManager() +env_manager.setup_mindformers_environment() diff --git a/tests/st/python/cases_parallel/multilora_inference.py b/tests/st/python/cases_parallel/multilora_inference.py index 0a1e3776b..57d362a71 100644 --- a/tests/st/python/cases_parallel/multilora_inference.py +++ b/tests/st/python/cases_parallel/multilora_inference.py @@ -24,7 +24,6 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager import vllm_mindspore # noqa: F401 from typing import Optional @@ -34,11 +33,10 @@ from vllm.lora.request import LoRARequest def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/shm_broadcast.py b/tests/st/python/cases_parallel/shm_broadcast.py index c82688c24..03f88f137 100644 --- a/tests/st/python/cases_parallel/shm_broadcast.py +++ b/tests/st/python/cases_parallel/shm_broadcast.py @@ -38,17 +38,13 @@ from vllm.utils import get_ip, get_open_port, get_distributed_init_method from tests.st.python.test_ds_online import env_vars from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() - - def get_arrays(n: int, seed: int = 0) -> list[np.ndarray]: np.random.seed(seed) sizes = np.random.randint(1, 10_000, n) diff --git a/tests/st/python/cases_parallel/vllm_deepseek_bf16_part.py b/tests/st/python/cases_parallel/vllm_deepseek_bf16_part.py index d11359169..524282593 100644 --- a/tests/st/python/cases_parallel/vllm_deepseek_bf16_part.py +++ b/tests/st/python/cases_parallel/vllm_deepseek_bf16_part.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_deepseek_bf16_part_v1.py b/tests/st/python/cases_parallel/vllm_deepseek_bf16_part_v1.py index 649f1b7a0..d83d08953 100644 --- a/tests/st/python/cases_parallel/vllm_deepseek_bf16_part_v1.py +++ b/tests/st/python/cases_parallel/vllm_deepseek_bf16_part_v1.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_deepseek_osl.py b/tests/st/python/cases_parallel/vllm_deepseek_osl.py index 68c54fd79..132f06dcc 100644 --- a/tests/st/python/cases_parallel/vllm_deepseek_osl.py +++ b/tests/st/python/cases_parallel/vllm_deepseek_osl.py @@ -25,15 +25,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_deepseek_part.py b/tests/st/python/cases_parallel/vllm_deepseek_part.py index 8ed5ce6f6..c34fac3e6 100644 --- a/tests/st/python/cases_parallel/vllm_deepseek_part.py +++ b/tests/st/python/cases_parallel/vllm_deepseek_part.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_deepseek_part_v1.py b/tests/st/python/cases_parallel/vllm_deepseek_part_v1.py index 06cacc355..f7f7fbc97 100644 --- a/tests/st/python/cases_parallel/vllm_deepseek_part_v1.py +++ b/tests/st/python/cases_parallel/vllm_deepseek_part_v1.py @@ -20,15 +20,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_deepseek_smoothquant.py b/tests/st/python/cases_parallel/vllm_deepseek_smoothquant.py index 748b43373..6289af065 100644 --- a/tests/st/python/cases_parallel/vllm_deepseek_smoothquant.py +++ b/tests/st/python/cases_parallel/vllm_deepseek_smoothquant.py @@ -23,15 +23,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_deepseek_smoothquant_mss.py b/tests/st/python/cases_parallel/vllm_deepseek_smoothquant_mss.py index 373306091..be545974d 100644 --- a/tests/st/python/cases_parallel/vllm_deepseek_smoothquant_mss.py +++ b/tests/st/python/cases_parallel/vllm_deepseek_smoothquant_mss.py @@ -23,15 +23,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_llama3.py b/tests/st/python/cases_parallel/vllm_llama3.py index 8355cbd81..ab01e639c 100644 --- a/tests/st/python/cases_parallel/vllm_llama3.py +++ b/tests/st/python/cases_parallel/vllm_llama3.py @@ -22,13 +22,16 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager + + +def teardown_function(): + """pytest calls the function after case function completed.""" + cleanup_subprocesses() + import vllm_mindspore from vllm import LLM, SamplingParams -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen3_8b.py b/tests/st/python/cases_parallel/vllm_mf_qwen3_8b.py index 7324d1c15..1f5ce1fe4 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen3_8b.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen3_8b.py @@ -20,15 +20,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen_7b.py b/tests/st/python/cases_parallel/vllm_mf_qwen_7b.py index 2ee512fda..eef712c32 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen_7b.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen_7b.py @@ -20,15 +20,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_chunk_prefill.py b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_chunk_prefill.py index ffb30ce93..7d4c1531b 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_chunk_prefill.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_chunk_prefill.py @@ -20,15 +20,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_chunk_prefill_v1.py b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_chunk_prefill_v1.py index 5d80b0a0b..21d81fbf5 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_chunk_prefill_v1.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_chunk_prefill_v1.py @@ -20,15 +20,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_cp_pc_mss.py b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_cp_pc_mss.py index 72a7c7aaa..37cfe7468 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_cp_pc_mss.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_cp_pc_mss.py @@ -20,15 +20,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_mss.py b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_mss.py index 30e5a49a5..cf65dc3f0 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_mss.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_mss.py @@ -20,15 +20,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_prefix_caching.py b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_prefix_caching.py index 8ac1e28cf..8a9c54f1e 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_prefix_caching.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_prefix_caching.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), "VLLM_MS_MODEL_BACKEND": "MindFormers", diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_prefix_caching_v1.py b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_prefix_caching_v1.py index 6fb0c6084..b2d6c4571 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_prefix_caching_v1.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_prefix_caching_v1.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), "VLLM_MS_MODEL_BACKEND": "MindFormers", diff --git a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_v1.py b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_v1.py index 70bca2447..3870b4d73 100644 --- a/tests/st/python/cases_parallel/vllm_mf_qwen_7b_v1.py +++ b/tests/st/python/cases_parallel/vllm_mf_qwen_7b_v1.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_mf_telechat2_7b.py b/tests/st/python/cases_parallel/vllm_mf_telechat2_7b.py index 0a38a51b9..8592728a5 100644 --- a/tests/st/python/cases_parallel/vllm_mf_telechat2_7b.py +++ b/tests/st/python/cases_parallel/vllm_mf_telechat2_7b.py @@ -20,15 +20,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_qwen2_5_vl_7b_v1.py b/tests/st/python/cases_parallel/vllm_qwen2_5_vl_7b_v1.py index dc36d5488..94a9b7b7f 100644 --- a/tests/st/python/cases_parallel/vllm_qwen2_5_vl_7b_v1.py +++ b/tests/st/python/cases_parallel/vllm_qwen2_5_vl_7b_v1.py @@ -24,17 +24,15 @@ import cv2 import numpy as np from PIL import Image from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager from tests.st.python.cases_parallel.similarity import compare_distance from transformers import AutoProcessor def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_qwen3.py b/tests/st/python/cases_parallel/vllm_qwen3.py index f2eb008c1..396c82408 100644 --- a/tests/st/python/cases_parallel/vllm_qwen3.py +++ b/tests/st/python/cases_parallel/vllm_qwen3.py @@ -22,15 +22,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_qwen3_moe.py b/tests/st/python/cases_parallel/vllm_qwen3_moe.py index ec2d57377..8a1fd6baa 100644 --- a/tests/st/python/cases_parallel/vllm_qwen3_moe.py +++ b/tests/st/python/cases_parallel/vllm_qwen3_moe.py @@ -22,15 +22,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_qwen_7b.py b/tests/st/python/cases_parallel/vllm_qwen_7b.py index 8a6e9301a..dbe3857fd 100644 --- a/tests/st/python/cases_parallel/vllm_qwen_7b.py +++ b/tests/st/python/cases_parallel/vllm_qwen_7b.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_qwen_7b_v1.py b/tests/st/python/cases_parallel/vllm_qwen_7b_v1.py index 35c3e0b70..81abb1c81 100644 --- a/tests/st/python/cases_parallel/vllm_qwen_7b_v1.py +++ b/tests/st/python/cases_parallel/vllm_qwen_7b_v1.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cases_parallel/vllm_sampling.py b/tests/st/python/cases_parallel/vllm_sampling.py index d9578d54c..960cebddd 100644 --- a/tests/st/python/cases_parallel/vllm_sampling.py +++ b/tests/st/python/cases_parallel/vllm_sampling.py @@ -19,15 +19,13 @@ from unittest.mock import patch import os from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() # def env env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), diff --git a/tests/st/python/cell/test_attention.py b/tests/st/python/cell/test_attention.py index 9216757ce..1919e0bc0 100644 --- a/tests/st/python/cell/test_attention.py +++ b/tests/st/python/cell/test_attention.py @@ -30,6 +30,13 @@ from vllm_mindspore.model_executor.layers.quantization.attention import ( from vllm.config import CacheConfig from vllm.attention.backends.abstract import AttentionType +from tests.st.python.utils.cases_parallel import cleanup_subprocesses + + +def teardown_function(): + """pytest calls the function after case function completed.""" + cleanup_subprocesses() + @pytest.fixture(params=[mstype.float16, mstype.bfloat16], ids=["float16", "bfloat16"]) diff --git a/tests/st/python/cell/test_smooth_quant.py b/tests/st/python/cell/test_smooth_quant.py index 4be2a5f7e..b0c0ec764 100644 --- a/tests/st/python/cell/test_smooth_quant.py +++ b/tests/st/python/cell/test_smooth_quant.py @@ -25,6 +25,13 @@ from mindspore.common.initializer import initializer from vllm_mindspore.model_executor.layers.quantization.smooth_quant_modelslim \ import A8W8DYNLinearMethod, A8W8LinearMethod, SmoothQuantModelSlimConfig +from tests.st.python.utils.cases_parallel import cleanup_subprocesses + + +def teardown_function(): + """pytest calls the function after case function completed.""" + cleanup_subprocesses() + @pytest.fixture(params=[mstype.float16, mstype.bfloat16], ids=["float16", "bfloat16"]) diff --git a/tests/st/python/test_custom_advstepflash.py b/tests/st/python/test_custom_advstepflash.py index cd779f319..91873dea5 100644 --- a/tests/st/python/test_custom_advstepflash.py +++ b/tests/st/python/test_custom_advstepflash.py @@ -26,6 +26,7 @@ from tests.st.python.utils.cases_parallel import cleanup_subprocesses def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() diff --git a/tests/st/python/test_deepseekv3_tool_parser.py b/tests/st/python/test_deepseekv3_tool_parser.py index c641fed55..8e8b0eed8 100644 --- a/tests/st/python/test_deepseekv3_tool_parser.py +++ b/tests/st/python/test_deepseekv3_tool_parser.py @@ -31,6 +31,13 @@ from vllm.entrypoints.openai.protocol import (ChatCompletionRequest, FunctionCall, ToolCall) from vllm.entrypoints.openai.tool_parsers import ToolParser, ToolParserManager +from tests.st.python.utils.cases_parallel import cleanup_subprocesses + + +def teardown_function(): + """pytest calls the function after case function completed.""" + cleanup_subprocesses() + class StreamingToolReconstructor: diff --git a/tests/st/python/test_ds_online.py b/tests/st/python/test_ds_online.py index ed342ffc3..b1c497cb5 100644 --- a/tests/st/python/test_ds_online.py +++ b/tests/st/python/test_ds_online.py @@ -26,10 +26,14 @@ import shlex import signal import time -from tests.st.python.utils.env_var_manager import EnvVarManager +from tests.st.python.utils.cases_parallel import cleanup_subprocesses + + +def teardown_function(): + """pytest calls the function after case function completed.""" + cleanup_subprocesses() + -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() env_vars = { "vLLM_MODEL_BACKEND": "MindFormers", "MS_ENABLE_LCCL": "off", diff --git a/tests/st/python/test_mcore_mix_parallel.py b/tests/st/python/test_mcore_mix_parallel.py index 148f08786..b017f41fe 100644 --- a/tests/st/python/test_mcore_mix_parallel.py +++ b/tests/st/python/test_mcore_mix_parallel.py @@ -22,15 +22,13 @@ import os from multiprocessing import Process, Queue from tests.st.python.utils.cases_parallel import cleanup_subprocesses -from tests.st.python.utils.env_var_manager import EnvVarManager def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -env_manager = EnvVarManager() -env_manager.setup_mindformers_environment() env_vars = { "ASCEND_CUSTOM_PATH": os.path.expandvars("$ASCEND_HOME_PATH/../"), "VLLM_MS_MODEL_BACKEND": "MindFormers", diff --git a/tests/st/python/test_sampler.py b/tests/st/python/test_sampler.py index 4a6c4795d..aabd6f347 100644 --- a/tests/st/python/test_sampler.py +++ b/tests/st/python/test_sampler.py @@ -45,6 +45,7 @@ from tests.st.python.utils.cases_parallel import cleanup_subprocesses def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() diff --git a/tests/st/python/test_sampler_v1.py b/tests/st/python/test_sampler_v1.py index 126629273..d696da90a 100644 --- a/tests/st/python/test_sampler_v1.py +++ b/tests/st/python/test_sampler_v1.py @@ -37,6 +37,7 @@ from tests.st.python.utils.cases_parallel import cleanup_subprocesses def teardown_function(): + """pytest calls the function after case function completed.""" cleanup_subprocesses() -- Gitee