Skip to content

Commit dfd6ab0

Browse files
committed
new kill_all fixture
1 parent e1142a5 commit dfd6ab0

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/test_terminal.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313

1414
# Kill all running terminals after each test to avoid cross-test issues
1515
# with still running terminals.
16-
@pytest.fixture(autouse=True)
16+
@pytest.fixture
1717
def kill_all(serverapp):
18-
yield
19-
serverapp.web_app.settings["terminal_manager"].kill_all()
18+
async def _():
19+
await serverapp.web_app.settings["terminal_manager"].kill_all()
20+
return _
2021

2122

2223
@pytest.fixture
@@ -29,7 +30,7 @@ def terminal_path(tmp_path):
2930
shutil.rmtree(str(subdir), ignore_errors=True)
3031

3132

32-
async def test_terminal_create(fetch):
33+
async def test_terminal_create(fetch, kill_all):
3334
await fetch(
3435
'api', 'terminals',
3536
method='POST',
@@ -45,9 +46,10 @@ async def test_terminal_create(fetch):
4546
data = json.loads(resp_list.body.decode())
4647

4748
assert len(data) == 1
49+
await kill_all()
4850

4951

50-
async def test_terminal_create_with_kwargs(fetch, ws_fetch, terminal_path):
52+
async def test_terminal_create_with_kwargs(fetch, ws_fetch, terminal_path, kill_all):
5153
resp_create = await fetch(
5254
'api', 'terminals',
5355
method='POST',
@@ -67,12 +69,14 @@ async def test_terminal_create_with_kwargs(fetch, ws_fetch, terminal_path):
6769
data = json.loads(resp_get.body.decode())
6870

6971
assert data['name'] == term_name
72+
await kill_all()
7073

7174

7275
async def test_terminal_create_with_cwd(
7376
fetch,
7477
ws_fetch,
75-
terminal_path
78+
terminal_path,
79+
kill_all
7680
):
7781
resp = await fetch(
7882
'api', 'terminals',
@@ -102,3 +106,4 @@ async def test_terminal_create_with_cwd(
102106

103107
ws.close()
104108
assert str(terminal_path) in messages
109+
await kill_all()

0 commit comments

Comments
 (0)