Skip to content

Commit 2aaf9b5

Browse files
authored
wait for terminate, then kill
1 parent ecfb646 commit 2aaf9b5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/conftest.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77
import time
88
from pathlib import Path
9-
from subprocess import Popen
9+
from subprocess import Popen, TimeoutExpired
1010
from typing import Any, Generator, Tuple
1111
from urllib.error import URLError
1212
from urllib.request import urlopen
@@ -86,7 +86,11 @@ def a_server(
8686

8787
# clean up after server is no longer needed
8888
print(f"{a_server_cmd} shutting down...", flush=True)
89-
server_proc.terminate()
89+
try:
90+
server_proc.terminate()
91+
server_proc.wait(20)
92+
except TimeoutExpired:
93+
server_proc.kill()
9094
print(f"{a_server_cmd} is stopped", flush=True)
9195

9296

0 commit comments

Comments
 (0)