Skip to content

Commit b5f5e04

Browse files
committed
Updated example as suggested by @jdreaver
1 parent 68228c3 commit b5f5e04

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docs/index.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,15 @@ ensuring the results are correct::
130130

131131
def test_long_computation(qtbot):
132132
app = Application()
133-
app.worker.start()
134133

134+
# Watch for the app.worker.finished signal, then start the worker.
135135
with qtbot.waitSignal(app.worker.finished, timeout=10000) as blocker:
136-
assert blocker.signal_triggered
137-
assert_application_results(app)
136+
blocker.connect(app.worker.failed) # Can add other signals to blocker
137+
app.worker.start()
138+
# Test will wait here until either signal is emitted, or 10 seconds has elapsed
139+
140+
assert blocker.signal_triggered # Assuming the work took less than 10 seconds
141+
assert_application_results(app)
138142

139143

140144
QtBot

0 commit comments

Comments
 (0)