slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
15.9k stars 519 forks source link

python's test_timer flacky #5484

Closed ogoffart closed 4 days ago

ogoffart commented 5 days ago

https://github.com/slint-ui/slint/actions/runs/9641761680/job/26588109691 https://github.com/slint-ui/slint/actions/runs/9675010479/job/26691717461

=================================== FAILURES ===================================
__________________________________ test_timer __________________________________

    def test_timer():
        global counter
        counter = 0
        def quit_after_two_invocations():
            global counter
            counter = counter + 1
            if counter >= 2:
                native.quit_event_loop()

        test_timer = native.Timer()
        test_timer.start(native.TimerMode.Repeated, timedelta(milliseconds=100), quit_after_two_invocations)
        native.run_event_loop()
        test_timer.stop()
>       assert(counter == 2)
E       assert 3 == 2

tests/test_timers.py:22: AssertionError
=========================== short test summary info ============================
FAILED tests/test_timers.py::test_timer - assert 3 == 2
======================== 1 failed, 24 passed in 10.60s =========================
tronical commented 4 days ago

Hmmm, I guess the event loop runs once more with the new winit - somehow. But at least it does terminate. Maybe I can make this more robust.