Skip to content

Commit 4517612

Browse files
author
Tony Crisci
committed
test: use workspace focus event instead of init
1 parent 2e1fa77 commit 4517612

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/aio/test_workspace.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,26 @@
44
import asyncio
55
from i3ipc import Event
66

7+
events = asyncio.Queue()
78

89
class TestWorkspace(IpcTest):
9-
event = None
1010

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)
1413

1514
@pytest.mark.asyncio
1615
async def test_workspace(self, i3):
1716
await i3.command('workspace 0')
1817
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+
2222
workspaces = await i3.get_workspaces()
2323

2424
assert len(workspaces) == 1
2525
ws = workspaces[0]
2626
assert ws.name == '12'
2727

28-
e = TestWorkspace.event
2928
assert e is not None
3029
assert e.current.name == '12'

0 commit comments

Comments
 (0)