Skip to content

Commit 47680ea

Browse files
authored
Fix test that creates orphaned subprocess (#711)
1 parent 462bce9 commit 47680ea

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/test_runserver_main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ async def hello(request):
120120

121121

122122
@forked
123-
def test_start_runserver_with_multi_app_modules(tmpworkdir, capfd):
123+
async def test_start_runserver_with_multi_app_modules(tmpworkdir, capfd):
124124
mktree(tmpworkdir, {
125125
"app.py": f"""\
126126
from aiohttp import web
@@ -149,10 +149,13 @@ async def create_app():
149149
app_task = AppTask(config)
150150

151151
app_task._start_dev_server()
152-
app_task._process.join(2)
152+
try:
153+
app_task._process.join(2)
153154

154-
captured = capfd.readouterr()
155-
assert captured.out == ""
155+
captured = capfd.readouterr()
156+
assert captured.out == ""
157+
finally:
158+
await app_task._stop_dev_server()
156159

157160

158161
@forked

0 commit comments

Comments
 (0)