Skip to content

Commit 6674052

Browse files
committed
f
1 parent 43bb844 commit 6674052

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

tests/test_conversation_logging_server.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,18 @@ def _start_server_with_logging(cls):
9494
env["OPTILLM_API_KEY"] = "optillm"
9595
env["OPTILLM_LOG_CONVERSATIONS"] = "true"
9696
env["OPTILLM_CONVERSATION_LOG_DIR"] = str(cls.temp_log_dir)
97-
97+
98+
# Get the project root directory (parent of tests directory)
99+
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
100+
98101
proc = subprocess.Popen([
99102
sys.executable, "optillm.py",
100103
"--model", TEST_MODEL,
101104
"--port", "8000",
102105
"--log-conversations",
103106
"--conversation-log-dir", str(cls.temp_log_dir)
104-
], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
105-
107+
], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=project_root)
108+
106109
return proc
107110

108111
def setUp(self):

tests/test_utils.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,20 @@ def start_test_server(model: str = TEST_MODEL, port: int = 8000) -> subprocess.P
4242
# Set environment for local inference
4343
env = os.environ.copy()
4444
env["OPTILLM_API_KEY"] = "optillm"
45-
46-
# Start server
45+
46+
# Get the project root directory (parent of tests directory)
47+
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
48+
49+
# Start server from project root where optillm.py is located
4750
proc = subprocess.Popen([
4851
sys.executable, "optillm.py",
4952
"--model", model,
5053
"--port", str(port)
51-
], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
52-
54+
], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=project_root)
55+
5356
# Wait for server to start
5457
time.sleep(5)
55-
58+
5659
return proc
5760

5861
def stop_test_server(proc: subprocess.Popen):

0 commit comments

Comments
 (0)