server tests: handle TimeoutExpired exception
This commit is contained in:
parent
731134958f
commit
4479b85b8a
1 changed files with 4 additions and 1 deletions
|
@ -5,6 +5,7 @@ import sys
|
|||
import time
|
||||
import traceback
|
||||
from contextlib import closing
|
||||
from subprocess import TimeoutExpired
|
||||
|
||||
|
||||
def before_scenario(context, scenario):
|
||||
|
@ -38,7 +39,9 @@ def after_scenario(context, scenario):
|
|||
|
||||
server_graceful_shutdown(context) # SIGINT
|
||||
|
||||
if context.server_process.wait(0.5) is None:
|
||||
try:
|
||||
context.server_process.wait(0.5)
|
||||
except TimeoutExpired:
|
||||
print(f"server still alive after 500ms, force-killing pid={context.server_process.pid} ...")
|
||||
context.server_process.kill() # SIGKILL
|
||||
context.server_process.wait()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue