File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 4
4
import asyncio
5
5
from i3ipc import Event
6
6
7
+ events = asyncio .Queue ()
7
8
8
9
class TestWorkspace (IpcTest ):
9
- event = None
10
10
11
- def on_workspace (self , i3 , e ):
12
- TestWorkspace .event = e
13
- i3 .main_quit ()
11
+ async def on_workspace (self , i3 , e ):
12
+ await events .put (e )
14
13
15
14
@pytest .mark .asyncio
16
15
async def test_workspace (self , i3 ):
17
16
await i3 .command ('workspace 0' )
18
17
await i3 .subscribe ([Event .WORKSPACE ])
19
- i3 .on (Event .WORKSPACE_INIT , self .on_workspace )
20
- asyncio .ensure_future (i3 .command ('workspace 12' ))
21
- await i3 .main ()
18
+ i3 .on (Event .WORKSPACE_FOCUS , self .on_workspace )
19
+ await i3 .command ('workspace 12' )
20
+ e = await events .get ()
21
+
22
22
workspaces = await i3 .get_workspaces ()
23
23
24
24
assert len (workspaces ) == 1
25
25
ws = workspaces [0 ]
26
26
assert ws .name == '12'
27
27
28
- e = TestWorkspace .event
29
28
assert e is not None
30
29
assert e .current .name == '12'
You can’t perform that action at this time.
0 commit comments