altdesktop / i3ipc-python

🐍 An improved Python library to control i3wm and sway.
http://i3ipc-python.readthedocs.io
BSD 3-Clause "New" or "Revised" License
858 stars 108 forks source link

test_detailed_window_event sometimes fails #192

Open pgajdos opened 2 years ago

pgajdos commented 2 years ago

On x86_64, it fails on OBS (build.opensuse.org) build and the process stucks. When build locally, it does not happen.

[   25s] ____________________ TestWindow.test_detailed_window_event _____________________
[   25s] 
[   25s] self = <test_window.TestWindow object at 0x7f9b7377a0a0>
[   25s] i3 = <i3ipc.connection.Connection object at 0x7f9b74003730>
[   25s] 
[   25s]     def test_detailed_window_event(self, i3):
[   25s]         events = []
[   25s]     
[   25s]         def generate_events():
[   25s]             win1 = self.open_window()
[   25s]             win2 = self.open_window()
[   25s]             i3.command(f'[id={win1}] kill; [id={win2}] kill')
[   25s]             # TODO sync protocol
[   25s]             time.sleep(0.01)
[   25s]             i3.main_quit()
[   25s]     
[   25s]         def on_window(i3, e):
[   25s]             nonlocal events
[   25s]             events.append(e)
[   25s]     
[   25s]         i3.on(Event.WINDOW_NEW, on_window)
[   25s]         Timer(0.01, generate_events).start()
[   25s]         i3.main(timeout=2)
[   25s]     
[   25s]         assert len(events)
[   25s]         for e in events:
[   25s]             assert e.change == 'new'
[   25s]     
[   25s]         events.clear()
[   25s]         i3.off(on_window)
[   25s]     
[   25s]         i3.on(Event.WINDOW_FOCUS, on_window)
[   25s]         Timer(0.01, generate_events).start()
[   25s]         i3.main(timeout=2)
[   25s]     
[   25s] >       assert len(events)
[   25s] E       assert 0
[   25s] E        +  where 0 = len([])
[   25s] 
[   25s] test/test_window.py:60: AssertionError
[..]
[   25s] 
[   25s] =========================== short test summary info ============================
[   25s] FAILED test/test_window.py::TestWindow::test_detailed_window_event - assert 0
[   25s] ====== 1 failed, 7 passed, 12 skipped, 6 deselected, 28 warnings in 1.18s ======