server : use pytest-xdist for server tests (#28298)

* server : use pytest-xdist for server tests

This commit adds pytest-xdist to the server tests. This is pytest
plugin that distributes test execution across multiple CPU cores.

Assisted-by: pi:llama.cpp/qwen3.8-27B

Refs: https://github.com/ggml-org/llama.cpp/pull/26734#issuecomment-5220707042

* remove server_base_port and BASE_PORT

* use worksteal and pytest builting tmp_path
This commit is contained in:
Daniel Bevenius
2026-09-03 15:04:30 +02:00
committed by GitHub
parent de8656bd94
commit 42f0225fea
10 changed files with 36 additions and 26 deletions
+4 -4
View File
@@ -10,10 +10,10 @@ STATE_FILE_HEADER_SIZE = 12
server = ServerPreset.tinyllama2()
@pytest.fixture(autouse=True)
def create_server():
def create_server(tmp_path):
global server
server = ServerPreset.tinyllama2()
server.slot_save_path = "./tmp"
server.slot_save_path = str(tmp_path)
server.temperature = 0.0
@@ -94,7 +94,7 @@ def test_slot_restore_legacy_token_list():
assert res.body["n_saved"] == 84
# rewrite the token payload into a plain token list, as written by servers that predate the packed server_tokens format
path = os.path.join("tmp", "slot_legacy.bin")
path = os.path.join(server.slot_save_path, "slot_legacy.bin")
with open(path, "rb") as f:
data = bytearray(f.read())
@@ -462,7 +462,7 @@ def test_slot_save_restore_image_payload_larger_than_context(mmproj_server):
})
assert res.status_code == 200
path = os.path.join("tmp", "mm_slot_large_payload.bin")
path = os.path.join(server.slot_save_path, "mm_slot_large_payload.bin")
with open(path, "rb") as f:
data = bytearray(f.read())
payload_size = struct.unpack_from("=I", data, STATE_FILE_HEADER_SIZE - 4)[0]