Unverified Commit 00d91c8a authored by Yongzao's avatar Yongzao Committed by GitHub
Browse files

[CI/Build] Simplify exception trace in api server tests (#9787)


Signed-off-by: default avataryoukaichao <youkaichao@gmail.com>
Co-authored-by: default avataryoukaichao <youkaichao@gmail.com>
parent c2cd1a21
...@@ -133,15 +133,19 @@ class RemoteOpenAIServer: ...@@ -133,15 +133,19 @@ class RemoteOpenAIServer:
try: try:
if requests.get(url).status_code == 200: if requests.get(url).status_code == 200:
break break
except Exception as err: except Exception:
# this exception can only be raised by requests.get,
# which means the server is not ready yet.
# the stack trace is not useful, so we suppress it
# by using `raise from None`.
result = self.proc.poll() result = self.proc.poll()
if result is not None and result != 0: if result is not None and result != 0:
raise RuntimeError("Server exited unexpectedly.") from err raise RuntimeError("Server exited unexpectedly.") from None
time.sleep(0.5) time.sleep(0.5)
if time.time() - start > timeout: if time.time() - start > timeout:
raise RuntimeError( raise RuntimeError(
"Server failed to start in time.") from err "Server failed to start in time.") from None
@property @property
def url_root(self) -> str: def url_root(self) -> str:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment