diff --git a/tests/test_idle.py b/tests/test_idle.py index 13a8e3c98d679fb1fe5dcb10044fe163fe6f852b..430e49fa06522681bae391320e898fb12180cbdb 100644 --- a/tests/test_idle.py +++ b/tests/test_idle.py @@ -157,6 +157,29 @@ def _test_idleTimeout(): assert idle.getIdleTimeout() == default +@pytest.mark.wxtest +def test_block_with_gui(): _run_with_wx( _test_block) +def test_block_without_gui(): _run_without_wx(_test_block) +def _test_block(): + + called = [False] + + if fslplatform.haveGui: + import wx + def idlefunc(): + called[0] = True + wx.CallLater(1000, idlefunc) + + start = time.time() + + idle.block(2) + end = time.time() + assert (end - start) >= 2 + + if fslplatform.haveGui: + assert called[0] + + @pytest.mark.wxtest def test_idle():