Skip to content

Commit ce08eae

Browse files
committed
Raise after exiting loop.
1 parent 0f11407 commit ce08eae

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

pytestqt/plugin.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,11 @@ def wait(self):
327327
if self.timeout is None and len(self._signals) == 0:
328328
raise ValueError("No signals or timeout specified.")
329329
if self.timeout is not None:
330-
QtCore.QTimer.singleShot(self.timeout, self._quit_loop_by_timeout)
330+
QtCore.QTimer.singleShot(self.timeout, self._loop.quit)
331331
self._loop.exec_()
332+
if not self.signal_triggered and self.raising:
333+
raise QtBot.SignalTimeout("Didn't get signal after %sms." %
334+
self.timeout)
332335

333336
def connect(self, signal):
334337
"""
@@ -347,17 +350,6 @@ def _quit_loop_by_signal(self):
347350
self.signal_triggered = True
348351
self._loop.quit()
349352

350-
def _quit_loop_by_timeout(self):
351-
"""
352-
quits the event loop and marks that we finished because of a timeout.
353-
"""
354-
assert not self.signal_triggered
355-
self._loop.quit()
356-
if self.raising:
357-
raise QtBot.SignalTimeout("Didn't get signal after %sms." %
358-
self.timeout)
359-
360-
361353
def __enter__(self):
362354
return self
363355

0 commit comments

Comments
 (0)