Skip to content

Commit 4d5d167

Browse files
committed
WIP
1 parent fc19753 commit 4d5d167

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

pytestqt/_tests/test_wait_signal.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,28 @@ def test_signal_blocker_exception(qtbot):
1919
qtbot.waitSignal(None, None).wait()
2020

2121

22-
def explicit_wait(qtbot, signal, timeout, multiple, raising, raises):
22+
def explicit_wait(qtbot, signal, timeout, multiple, raising, should_raise):
2323
"""
2424
Explicit wait for the signal using blocker API.
2525
"""
2626
func = qtbot.waitSignals if multiple else qtbot.waitSignal
2727
blocker = func(signal, timeout, raising=raising)
2828
assert not blocker.signal_triggered
29-
if raises:
29+
if should_raise:
3030
with pytest.raises(qtbot.SignalTimeoutError):
3131
blocker.wait()
3232
else:
3333
blocker.wait()
3434
return blocker
3535

3636

37-
def context_manager_wait(qtbot, signal, timeout, multiple, raising, raises):
37+
def context_manager_wait(qtbot, signal, timeout, multiple, raising,
38+
should_raise):
3839
"""
3940
Waiting for signal using context manager API.
4041
"""
4142
func = qtbot.waitSignals if multiple else qtbot.waitSignal
42-
if raises:
43+
if should_raise:
4344
with pytest.raises(qtbot.SignalTimeoutError):
4445
with func(signal, timeout, raising=raising) as blocker:
4546
pass
@@ -66,8 +67,8 @@ def context_manager_wait(qtbot, signal, timeout, multiple, raising, raises):
6667
(context_manager_wait, 2000, 500, False, True),
6768
]
6869
)
69-
def test_signal_triggered(qtbot, single_shot, wait_function, emit_delay, timeout,
70-
expected_signal_triggered, raising):
70+
def test_signal_triggered(qtbot, single_shot, wait_function, emit_delay,
71+
timeout, expected_signal_triggered, raising):
7172
"""
7273
Testing for a signal in different conditions, ensuring we are obtaining
7374
the expected results.
@@ -76,10 +77,10 @@ def test_signal_triggered(qtbot, single_shot, wait_function, emit_delay, timeout
7677
single_shot(signaller.signal, emit_delay)
7778

7879
start_time = time.time()
79-
raises = raising and not expected_signal_triggered
80+
should_raise = raising and not expected_signal_triggered
8081

8182
blocker = wait_function(qtbot, signaller.signal, timeout, raising=raising,
82-
raises=raises, multiple=False)
83+
should_raise=should_raise, multiple=False)
8384

8485
# Check that event loop exited.
8586
assert not blocker._loop.isRunning()
@@ -114,8 +115,7 @@ def test_signal_triggered(qtbot, single_shot, wait_function, emit_delay, timeout
114115
]
115116
)
116117
def test_signal_triggered_multiple(qtbot, single_shot, wait_function,
117-
emit_delay_1,
118-
emit_delay_2, timeout,
118+
emit_delay_1, emit_delay_2, timeout,
119119
expected_signal_triggered, raising):
120120
"""
121121
Testing for a signal in different conditions, ensuring we are obtaining
@@ -125,11 +125,11 @@ def test_signal_triggered_multiple(qtbot, single_shot, wait_function,
125125
single_shot(signaller.signal, emit_delay_1)
126126
single_shot(signaller.signal_2, emit_delay_2)
127127

128-
raises = raising and not expected_signal_triggered
128+
should_raise = raising and not expected_signal_triggered
129129
start_time = time.time()
130130
blocker = wait_function(qtbot, [signaller.signal, signaller.signal_2],
131131
timeout, multiple=True, raising=raising,
132-
raises=raises)
132+
should_raise=should_raise)
133133

134134
# Check that event loop exited.
135135
assert not blocker._loop.isRunning()
@@ -177,6 +177,7 @@ def single_shot():
177177
178178
The fixture is responsible for cleaning up after the timers.
179179
"""
180+
180181
def shoot(signal, delay):
181182
timer = QtCore.QTimer()
182183
timer.setSingleShot(True)

0 commit comments

Comments
 (0)