13
13
14
14
# Kill all running terminals after each test to avoid cross-test issues
15
15
# with still running terminals.
16
- @pytest .fixture ( autouse = True )
16
+ @pytest .fixture
17
17
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 _
20
21
21
22
22
23
@pytest .fixture
@@ -29,7 +30,7 @@ def terminal_path(tmp_path):
29
30
shutil .rmtree (str (subdir ), ignore_errors = True )
30
31
31
32
32
- async def test_terminal_create (fetch ):
33
+ async def test_terminal_create (fetch , kill_all ):
33
34
await fetch (
34
35
'api' , 'terminals' ,
35
36
method = 'POST' ,
@@ -45,9 +46,10 @@ async def test_terminal_create(fetch):
45
46
data = json .loads (resp_list .body .decode ())
46
47
47
48
assert len (data ) == 1
49
+ await kill_all ()
48
50
49
51
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 ):
51
53
resp_create = await fetch (
52
54
'api' , 'terminals' ,
53
55
method = 'POST' ,
@@ -67,12 +69,14 @@ async def test_terminal_create_with_kwargs(fetch, ws_fetch, terminal_path):
67
69
data = json .loads (resp_get .body .decode ())
68
70
69
71
assert data ['name' ] == term_name
72
+ await kill_all ()
70
73
71
74
72
75
async def test_terminal_create_with_cwd (
73
76
fetch ,
74
77
ws_fetch ,
75
- terminal_path
78
+ terminal_path ,
79
+ kill_all
76
80
):
77
81
resp = await fetch (
78
82
'api' , 'terminals' ,
@@ -102,3 +106,4 @@ async def test_terminal_create_with_cwd(
102
106
103
107
ws .close ()
104
108
assert str (terminal_path ) in messages
109
+ await kill_all ()
0 commit comments