Skip to content

Commit e9c00f3

Browse files
committed
Removing loop from SignalBlocker API, used only by tests
1 parent c656d5b commit e9c00f3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pytestqt/_tests/test_wait_signal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def explicit_wait(qtbot, signal, timeout):
2525
blocker = qtbot.waitSignal(signal, timeout)
2626
start_time = time.time()
2727
blocker.wait()
28-
return blocker.loop, start_time
28+
return blocker._loop, start_time
2929

3030

3131
def context_manager_wait(qtbot, signal, timeout):
@@ -34,7 +34,7 @@ def context_manager_wait(qtbot, signal, timeout):
3434
"""
3535
with qtbot.waitSignal(signal, timeout) as blocker:
3636
start_time = time.time()
37-
return blocker.loop, start_time
37+
return blocker._loop, start_time
3838

3939

4040
@pytest.mark.parametrize(

pytestqt/plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,19 +252,19 @@ def waitSignal(self, signal=None, timeout=1000):
252252
class SignalBlocker:
253253

254254
def __init__(self, timeout=1000):
255-
self.loop = QtCore.QEventLoop()
255+
self._loop = QtCore.QEventLoop()
256256
self._signals = []
257257
self.timeout = timeout
258258

259259
def wait(self):
260260
if self.timeout is None and len(self._signals) == 0:
261261
raise ValueError("No signals or timeout specified.")
262262
if self.timeout is not None:
263-
QtCore.QTimer.singleShot(self.timeout, self.loop.quit)
264-
self.loop.exec_()
263+
QtCore.QTimer.singleShot(self.timeout, self._loop.quit)
264+
self._loop.exec_()
265265

266266
def connect(self, signal):
267-
signal.connect(self.loop.quit)
267+
signal.connect(self._loop.quit)
268268
self._signals.append(signal)
269269

270270
def __enter__(self):

0 commit comments

Comments
 (0)