Pytest-qt

Latest version: v4.4.0

Safety actively analyzes 682404 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 3

1.2.3

Now the module `qt_compat` no longer sets `QString` and `QVariant` apis to `2` for PyQt, making it compatible for those still using version `1` of the API.

1.2.2

- Now it is possible to disable automatic exception capture by using markers or a `pytest.ini` option. Consult the documentation for more information. (26, thanks datalyze-solutions for bringing this up)
- `QApplication` instance is created only if it wasn't created yet (21, thanks fabioz!)
- `addWidget` now keeps a weak reference its widgets (20, thanks fabioz)

1.2.1

- Fixed 16: a signal emitted immediately inside a `waitSignal` block now works as expected (thanks baudren)

1.2.0

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:

python
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)

1.1.1

- Added `stop` as an alias for `stopForInteraction` (10, thanks itghisi)
- Now exceptions raised in virtual methods make tests fail, instead of silently passing (11). If an exception is raised, the test will fail and it exceptions that happened inside virtual calls will be printed as such:


E Failed: Qt exceptions in virtual methods:
E ________________________________________________________________________________
E File "x:\pytest-qt\pytestqt\_tests\test_exceptions.py", line 14, in event
E raise ValueError('mistakes were made')
E
E ValueError: mistakes were made
E ________________________________________________________________________________
E File "x:\pytest-qt\pytestqt\_tests\test_exceptions.py", line 14, in event
E raise ValueError('mistakes were made')
E
E ValueError: mistakes were made
E ________________________________________________________________________________


Thanks to jdreaver for request and sample code!
- Fixed documentation for `QtBot`: it was not being rendered in the docs due to an import error.

1.1

This release adds support for Python 3+.

Page 2 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.