Skip to content

Commit 3c84863

Browse files
committed
try fix #40
1 parent b10c96b commit 3c84863

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/conftest.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import signal
22
import subprocess
33
import sys
4+
import time
45
from dataclasses import dataclass, field
56
from pathlib import Path
67
from typing import Any
@@ -21,21 +22,27 @@ class ServerFixture:
2122
model: str = field(default=None)
2223

2324

24-
def wait_for_server(url, timeout=10):
25+
def wait_for_server(url, timeout=26):
2526
session = requests.Session()
26-
session.mount("http://", HTTPAdapter(max_retries=Retry(total=20, backoff_factor=0.05)))
27+
session.mount("http://", HTTPAdapter(max_retries=Retry(total=10, backoff_factor=0.1)))
2728
session.get(url, timeout=timeout)
2829

2930

3031
def start_proxy(config_path: str, port: int):
3132
proc = subprocess.Popen([sys.executable, "-m", "lm_proxy.app", "--config", config_path])
33+
time.sleep(2)
3234
wait_for_server(f"http://127.0.0.1:{port}/health")
3335
return proc
3436

3537

3638
def stop_proxy(proc):
37-
proc.send_signal(signal.SIGTERM)
38-
proc.wait()
39+
proc.terminate()
40+
try:
41+
proc.wait(timeout=10)
42+
except subprocess.TimeoutExpired:
43+
proc.kill()
44+
proc.wait(timeout=5)
45+
3946

4047

4148
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)