diff --git a/tests/cov_pytest.ini b/tests/cov_pytest.ini index 7a0f2f32b3e..58f3820fca3 100644 --- a/tests/cov_pytest.ini +++ b/tests/cov_pytest.ini @@ -12,4 +12,3 @@ addopts = --ignore=tests/e2e/golang_router --ignore=tests/v1/test_schedule_output.py --ignore=tests/graph_optimization/test_cuda_graph_dynamic_subgraph.py - --ignore=tests/distributed/test_communication.py diff --git a/tests/distributed/test_communication.py b/tests/distributed/test_communication.py index 6906d5114e0..9df4b4ab2cc 100644 --- a/tests/distributed/test_communication.py +++ b/tests/distributed/test_communication.py @@ -52,7 +52,7 @@ def test_use_custom_allreduce(self, mock_custom_ar, mock_get_hcg): communication.use_custom_allreduce() self.assertIsNotNone(communication._TP_AR) - mock_custom_ar.assert_called_once_with(fake_group, 64 * 1024 * 1024) + mock_custom_ar.assert_called_once_with(fake_group, 8 * 1024 * 1024) def test_custom_ar_clear_ipc_handles(self): mock_tp_ar = MagicMock() diff --git a/tests/engine/test_async_llm.py b/tests/engine/test_async_llm.py index ee88b01c675..9abbce15088 100644 --- a/tests/engine/test_async_llm.py +++ b/tests/engine/test_async_llm.py @@ -16,10 +16,15 @@ import asyncio import os +import sys import unittest import uuid import weakref +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..")) + +from e2e.utils.serving_utils import clean_ports + from fastdeploy.engine.args_utils import EngineArgs from fastdeploy.engine.async_llm import AsyncLLM from fastdeploy.engine.sampling_params import SamplingParams @@ -42,6 +47,10 @@ class TestAsyncLLMEngine(unittest.TestCase): def setUpClass(cls): """Set up AsyncLLM for testing""" try: + # Clean ports before starting the engine + print("Pre-test port cleanup...") + clean_ports() + # Use unique ports to avoid conflicts base_port = int(os.getenv("FD_ENGINE_QUEUE_PORT", "6778")) cache_port = int(os.getenv("FD_CACHE_QUEUE_PORT", "6779")) diff --git a/tests/engine/test_common_engine.py b/tests/engine/test_common_engine.py index 9c70097058c..5a6241c4433 100644 --- a/tests/engine/test_common_engine.py +++ b/tests/engine/test_common_engine.py @@ -16,14 +16,18 @@ import asyncio import os +import sys import threading import time import types import unittest from unittest.mock import ANY, AsyncMock, MagicMock, Mock, patch +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..")) + import numpy as np import paddle +from e2e.utils.serving_utils import clean_ports if not hasattr(paddle, "compat"): @@ -82,6 +86,10 @@ class TestCommonEngine(unittest.TestCase): def setUpClass(cls): """Set up EngineService for testing""" try: + # Clean ports before starting the engine + print("Pre-test port cleanup...") + clean_ports() + # Create engine args for testing engine_args = EngineArgs( model=MODEL_NAME, diff --git a/tests/engine/test_resource_manager_v1.py b/tests/engine/test_resource_manager_v1.py index 0031a2e4f69..23275f29f70 100644 --- a/tests/engine/test_resource_manager_v1.py +++ b/tests/engine/test_resource_manager_v1.py @@ -13,6 +13,7 @@ # limitations under the License. import os +import sys import unittest from unittest.mock import Mock @@ -20,6 +21,9 @@ from fastdeploy.engine.request import Request, RequestStatus from fastdeploy.engine.sched.resource_manager_v1 import ResourceManagerV1 +sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..")) +from e2e.utils.serving_utils import clean_ports + MODEL_NAME = os.getenv("MODEL_PATH", "/path/to/models") + "/ERNIE-4.5-0.3B-Paddle" @@ -28,6 +32,9 @@ class TestResourceManagerV1(unittest.TestCase): def setUp(self): """Set up test fixtures.""" + # Clean ports before each test + clean_ports() + engine_args = EngineArgs( model=MODEL_NAME, max_model_len=8192,