def handler(): nonlocal called called = True now = glib_loop.time() glib_loop.stop() assert now >= s + 1
def second(): nonlocal passed assert glib_loop._running glib_loop.stop() assert glib_loop._running passed = True
def test_stop(self, glib_loop): with mock.patch.object(glib_loop, "_mainloop") as ml: glib_loop.stop() ml.quit.assert_any_call() glib_loop.set_application(Gio.Application()) with mock.patch.object(glib_loop, "_application") as app: glib_loop.stop() app.quit.assert_any_call()
def test_stop(self, glib_loop): with mock.patch.object(glib_loop, '_mainloop') as ml: glib_loop.stop() ml.quit.assert_any_call() glib_loop.set_application(Gio.Application()) with mock.patch.object(glib_loop, '_application') as app: glib_loop.stop() app.quit.assert_any_call()
def handler(): nonlocal called called = True now = glib_loop.time() glib_loop.stop() print(now, s) assert now - s <= 0.2
def handler(): nonlocal called called = True now = glib_loop.time() glib_loop.stop() print(now, s) import math assert math.isclose(now, s, abs_tol=0.1)
def handler(): nonlocal called called = True glib_loop.stop()
def callback(*args): nonlocal called called = True glib_loop.stop()
def timeout(): nonlocal timeout_occurred timeout_occurred = True glib_loop.stop()
def callback(): nonlocal i i += 1 if i == expected_i: glib_loop.stop()
def remover(fd): nonlocal removed assert glib_loop.remove_writer(fd) removed = True glib_loop.stop()