-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behaviour of waitSignal #16
Comments
Hi, Ouch, you found a bug! 😅 Usually the code inside a def test_window(qtbot, widget):
with qtbot.waitSignal(app.worker.finished, timeout=10000) as blocker:
# start() will schedule the signal to be emitted in the next event loop
app.worker.start() but your example is triggering it immediately inside the block. I'm working on a fix and will publish a new release. Many thanks! 😄 |
Published 1.2.1. Thanks again! 😄 |
Wow, thanks to you for such a quick reaction! Looking forward to playtest my application, now! |
Nice, thanks again! 😄
|
I just encountered this bug, and was about to make a fix. Next thing I know it's already fixed! I can't believe we left instantaneous signals out of our original tests for this feature. Thanks @baudren and @nicoddemus! |
@jdreaver I don't believe it either, hehehe! 😅 |
Problem description
I am having troubles with understanding how to use the functionality
qtbot.waitSignal
. I followed the documentation but there must be something I am missing.It seems that a direct call to the
emit
method of a given signal does not trigger a blockwith qtbot.waitSignal(...
to validate.I found the problem by testing my application, checking if a button was sending a signal, and noted that the
waitSignal
was always hitting the timeout. I extracted what I think is a bug, but might be to my very new discovery of signals and slots.What I expected / what I get
in a file
test_sample.py
:Running
py.test
on this file results in anAssertionError
, becausewaiting.signal_triggered
isFalse
. I expected theemit
method to causewaiting
to see the signal being emitted.Possible things I might do wrong
Since I am new to this signal/slot business, I might be overlooking some essential facts.
emit
code somehow placed at the wrong spot?Thank you for enlightening me, and thanks for sharing such a useful work, by the way. Testing GUI applications without this would be a massive pain.
Configuration
I am using Python
2.7.5
, pytest1.4.24
, and PySide1.2.2
, on a Linux Mint 16.The text was updated successfully, but these errors were encountered: