[XPU] [Test] Extend spawn-safe sitecustomize monkeypatch to XPU (#57911)
Signed-off-by: Chaojun Zhang <chaojun.zhang@intel.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: xiangdong <40376367+zxd1997066@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
xiangdong
parent
5555a2d8f7
commit
b337523c11
@@ -30,7 +30,7 @@ def evil_method(self, *args, **kwargs):
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def rocm_evil_method(rocm_sitecustomize_factory, request):
|
||||
def evil_method_fixture(spawn_sitecustomize_factory, request):
|
||||
failing_method = request.getfixturevalue("failing_method")
|
||||
lines = [
|
||||
"from vllm.distributed import get_tensor_model_parallel_rank",
|
||||
@@ -38,7 +38,7 @@ def rocm_evil_method(rocm_sitecustomize_factory, request):
|
||||
inspect.getsource(evil_method),
|
||||
f"LlamaForCausalLM.{failing_method} = {evil_method.__name__}",
|
||||
]
|
||||
rocm_sitecustomize_factory(lines)
|
||||
spawn_sitecustomize_factory(lines)
|
||||
|
||||
|
||||
@pytest.mark.timeout(SHUTDOWN_TEST_TIMEOUT_SEC)
|
||||
@@ -47,7 +47,7 @@ def rocm_evil_method(rocm_sitecustomize_factory, request):
|
||||
@pytest.mark.parametrize("failing_method", ["forward", "load_weights"])
|
||||
def test_async_llm_startup_error(
|
||||
monkeypatch,
|
||||
rocm_evil_method,
|
||||
evil_method_fixture,
|
||||
model: str,
|
||||
tensor_parallel_size: int,
|
||||
failing_method: str,
|
||||
@@ -84,7 +84,7 @@ def test_async_llm_startup_error(
|
||||
@pytest.mark.parametrize("failing_method", ["forward", "load_weights"])
|
||||
def test_llm_startup_error(
|
||||
monkeypatch,
|
||||
rocm_evil_method,
|
||||
evil_method_fixture,
|
||||
model: str,
|
||||
tensor_parallel_size: int,
|
||||
enable_multiprocessing: bool,
|
||||
|
||||
Reference in New Issue
Block a user