From 1cdac302b1d7352c31952cb1cc6c28bb2f145611 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Fri, 18 Oct 2019 18:06:50 +0100 Subject: [PATCH] TEST: Test new idle.block option --- tests/test_idle.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_idle.py b/tests/test_idle.py index 84a11b968..90c28c709 100644 --- a/tests/test_idle.py +++ b/tests/test_idle.py @@ -184,6 +184,25 @@ def _test_block(): assert called[0] +@pytest.mark.wxtest +def test_block_until_with_gui(): _run_with_wx( _test_block_until) +def test_block_until_without_gui(): _run_without_wx(_test_block_until) +def _test_block_until(): + ev = threading.Event() + + def task(): + time.sleep(1) + ev.set() + + threading.Thread(target=task).start() + + start = time.time() + idle.block(3, until=ev.is_set) + end = time.time() + + assert end - start < 3 + + @pytest.mark.wxtest def test_idle(): -- GitLab