You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def test_long_computation(qtbot):
app = Application()
# Watch for the app.worker.finished signal, then start the worker.
with qtbot.waitSignal(app.worker.finished, timeout=10000) as blocker:
blocker.connect(app.worker.failed) # Can add other signals to blocker
app.worker.start()
# Test will block at this point until signal is emitted or
# 10 seconds has elapsed
assert blocker.signal_triggered, "process timed-out"
assert_application_results(app)
Except this does not work for me because Application() and assert_application_results are not defined. But the example reads as if this is a necessary step to verify the signal result. Is there some import required for these to function? Are they obsolete? Or if these are simply an example of how one could assert things on app at that point in the test, consider clarifying the example as written.
How to get the QApplication instance when using qtbot is a bit mysterious in the docs too. It just says you can. Application appears to be replaceable using from pytestqt.qt_compat import qt_api; Application = qt_api.QtWidgets.QApplication.instance but I have no idea if this is good practice.
The text was updated successfully, but these errors were encountered:
Or if these are simply an example of how one could assert things on app at that point in the test
Yeah those are meant as examples of that, sorry that is not very clear.
How to get the QApplication instance when using qtbot is a bit mysterious in the docs too. It just says you can.
Application appears to be replaceable using from pytestqt.qt_compat import qt_api; Application = qt_api.QtWidgets.QApplication.instance but I have no idea if this is good practice.
No that Application is not meant to be a QApplication, just as placeholder meaning "your application class" or something like that.
Feel free to open a PR clarifying the docs (or even using a more explicit example if you come up with one), would love to review/merge a PR in that direction.
The current docs (https://pytest-qt.readthedocs.io/en/1.5.0/signals.html ) give some examples like this:
Except this does not work for me because
Application()
andassert_application_results
are not defined. But the example reads as if this is a necessary step to verify the signal result. Is there some import required for these to function? Are they obsolete? Or if these are simply an example of how one could assert things onapp
at that point in the test, consider clarifying the example as written.How to get the QApplication instance when using
qtbot
is a bit mysterious in the docs too. It just says you can.Application
appears to be replaceable usingfrom pytestqt.qt_compat import qt_api; Application = qt_api.QtWidgets.QApplication.instance
but I have no idea if this is good practice.The text was updated successfully, but these errors were encountered: