pytest-dev / pytest-dev/pytest-qt
Clarify documentation around qtbot.waitSignals
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 455
- Forks
- 72
- Avg merge
- 12h 26m
- Merged PRs (30d)
- 1
Description
The current docs (https://pytest-qt.readthedocs.io/en/1.5.0/signals.html ) give some examples like this:
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the signals.html documentation linked in the issue, especially the qtbot.waitSignal example, and review the qt_api.QtWidgets.QApplication.instance entry point mentioned in the report. Clarify whether Application and assert_application_results are illustrative placeholders, and explain how to access the QApplication instance; done means the examples and guidance no longer suggest undefined required objects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100