Skip to content

Commit 4479b85

Browse files
committed
server tests: handle TimeoutExpired exception
1 parent 7311349 commit 4479b85

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/server/tests/features/environment.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import time
66
import traceback
77
from contextlib import closing
8+
from subprocess import TimeoutExpired
89

910

1011
def before_scenario(context, scenario):
@@ -38,7 +39,9 @@ def after_scenario(context, scenario):
3839

3940
server_graceful_shutdown(context) # SIGINT
4041

41-
if context.server_process.wait(0.5) is None:
42+
try:
43+
context.server_process.wait(0.5)
44+
except TimeoutExpired:
4245
print(f"server still alive after 500ms, force-killing pid={context.server_process.pid} ...")
4346
context.server_process.kill() # SIGKILL
4447
context.server_process.wait()

0 commit comments

Comments
 (0)