pypi pytest-qt 1.2.0
waitSignal support added

latest releases: 4.4.0, 4.3.1, 4.2.0...
9 years ago

This version include the new waitSignal function, which makes it easy to write tests for long running computations that happen in other threads or processes:

    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 wait here until either signal is emitted, or 10 seconds has elapsed

        assert blocker.signal_triggered  # Assuming the work took less than 10 seconds
        assert_application_results(app)

Many thanks to @jdreaver for discussion and complete PR! (#12, #13)

Don't miss a new pytest-qt release

NewReleases is sending notifications on new releases.