mirror of
https://github.com/pyapp-kit/superqt.git
synced 2025-12-13 09:50:05 +01:00
test: change wait pattern (#187)
* test: change wait pattern * style: [pre-commit.ci] auto fixes [...] --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import inspect
|
||||
import threading
|
||||
import time
|
||||
import warnings
|
||||
from functools import partial
|
||||
@@ -280,15 +281,20 @@ def test_abort_does_not_return(qtbot):
|
||||
def test_nested_threads_start(qtbot):
|
||||
mock1 = Mock()
|
||||
mock2 = Mock()
|
||||
event = threading.Event()
|
||||
|
||||
def call_mock(_e=event):
|
||||
def nested_func():
|
||||
mock2()
|
||||
_e.set()
|
||||
|
||||
def call_mock():
|
||||
mock1()
|
||||
worker2 = qthreading.create_worker(mock2)
|
||||
worker2 = qthreading.create_worker(nested_func)
|
||||
worker2.start()
|
||||
|
||||
worker = qthreading.create_worker(call_mock)
|
||||
worker.start()
|
||||
|
||||
qtbot.wait(20)
|
||||
event.wait(timeout=2)
|
||||
mock1.assert_called_once()
|
||||
mock2.assert_called_once()
|
||||
|
||||
Reference in New Issue
Block a user