All Projects → pytest-dev → Pytest Qt

pytest-dev / Pytest Qt

Licence: mit
pytest plugin for Qt (PyQt4, PyQt5 and PySide) application testing

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pytest Qt

Quaternion
A Qt5-based IM client for Matrix
Stars: ✭ 438 (+108.57%)
Mutual labels:  hacktoberfest, qt
Schemathesis
A modern API testing tool for web applications built with Open API and GraphQL specifications.
Stars: ✭ 768 (+265.71%)
Mutual labels:  hacktoberfest, pytest
Mudlet
⚔️ A cross-platform, open source, and super fast MUD client with scripting in Lua
Stars: ✭ 427 (+103.33%)
Mutual labels:  hacktoberfest, qt
Pytest Picked
Run the tests related to the changed files (according to Git) 🤓
Stars: ✭ 262 (+24.76%)
Mutual labels:  hacktoberfest, pytest
Kbbi Qt
KBBI Offline Remake with Qt
Stars: ✭ 68 (-67.62%)
Mutual labels:  hacktoberfest, qt
Score
ossia score, an interactive sequencer for the intermedia arts.
Stars: ✭ 808 (+284.76%)
Mutual labels:  hacktoberfest, qt
Vue Nodegui
Build performant, native and cross-platform desktop applications with native Vue + powerful CSS like styling.🚀
Stars: ✭ 575 (+173.81%)
Mutual labels:  hacktoberfest, qt
Pytest Recording
A pytest plugin that allows recording network interactions via VCR.py
Stars: ✭ 98 (-53.33%)
Mutual labels:  hacktoberfest, pytest
Tiled
Flexible level editor
Stars: ✭ 8,411 (+3905.24%)
Mutual labels:  hacktoberfest, qt
Pytest Mock
Thin-wrapper around the mock package for easier use with pytest
Stars: ✭ 1,020 (+385.71%)
Mutual labels:  hacktoberfest, pytest
Pytest Regressions
Pytest plugin for regression testing: https://pytest-regressions.readthedocs.io
Stars: ✭ 89 (-57.62%)
Mutual labels:  hacktoberfest, pytest
Flameshot
Powerful yet simple to use screenshot software 🖥️ 📸
Stars: ✭ 15,429 (+7247.14%)
Mutual labels:  hacktoberfest, qt
Eslint Plugin Ava
ESLint rules for AVA
Stars: ✭ 209 (-0.48%)
Mutual labels:  hacktoberfest
Bookmarks
🔖 +4.3K awesome resources for geeks and software crafters 🍺
Stars: ✭ 210 (+0%)
Mutual labels:  hacktoberfest
Seo
SEO utilities including a unique field type, sitemap & redirect manager
Stars: ✭ 210 (+0%)
Mutual labels:  hacktoberfest
Qt Aes
Native Qt AES encryption class
Stars: ✭ 207 (-1.43%)
Mutual labels:  qt
Closedxml
ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.
Stars: ✭ 2,799 (+1232.86%)
Mutual labels:  hacktoberfest
Tldr
Golang command line client for tldr https://github.com/tldr-pages/tldr
Stars: ✭ 210 (+0%)
Mutual labels:  hacktoberfest
Add
Разработка с управляемым качеством на 1С
Stars: ✭ 210 (+0%)
Mutual labels:  hacktoberfest
Teku
Java Implementation of the Ethereum 2.0 Beacon Chain
Stars: ✭ 209 (-0.48%)
Mutual labels:  hacktoberfest

========= pytest-qt

pytest-qt is a pytest_ plugin that allows programmers to write tests for PyQt5_ and PySide2_ applications.

The main usage is to use the qtbot fixture, responsible for handling qApp creation as needed and provides methods to simulate user interaction, like key presses and mouse clicks:

.. code-block:: python

def test_hello(qtbot):
    widget = HelloWidget()
    qtbot.addWidget(widget)

    # click in the Greet button and make sure it updates the appropriate label
    qtbot.mouseClick(widget.button_greet, QtCore.Qt.LeftButton)

    assert widget.greet_label.text() == "Hello!"

.. _PySide2: https://pypi.org/project/PySide2/ .. _PyQt5: https://pypi.org/project/PyQt5/ .. _pytest: http://pytest.org

This allows you to test and make sure your view layer is behaving the way you expect after each code change.

.. |version| image:: http://img.shields.io/pypi/v/pytest-qt.svg :target: https://pypi.python.org/pypi/pytest-qt

.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/pytest-qt.svg :target: https://anaconda.org/conda-forge/pytest-qt

.. |ci| image:: https://github.com/pytest-dev/pytest-qt/workflows/build/badge.svg :target: https://github.com/pytest-dev/pytest-qt/actions

.. |coverage| image:: http://img.shields.io/coveralls/pytest-dev/pytest-qt.svg :target: https://coveralls.io/r/pytest-dev/pytest-qt

.. |docs| image:: https://readthedocs.org/projects/pytest-qt/badge/?version=latest :target: https://pytest-qt.readthedocs.io

.. |python| image:: https://img.shields.io/pypi/pyversions/pytest-qt.svg :target: https://pypi.python.org/pypi/pytest-qt/ :alt: Supported Python versions

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/ambv/black

|python| |version| |conda-forge| |ci| |coverage| |docs| |black|

Features

  • qtbot_ fixture to simulate user interaction with Qt widgets.
  • Automatic capture_ of qDebug, qWarning and qCritical messages;
  • waitSignal_ and waitSignals_ functions to block test execution until specific signals are emitted.
  • Exceptions in virtual methods and slots_ are automatically captured and fail tests accordingly.

.. _qtbot: https://pytest-qt.readthedocs.io/en/latest/reference.html#module-pytestqt.qtbot .. _Automatic capture: https://pytest-qt.readthedocs.io/en/latest/logging.html .. _waitSignal: https://pytest-qt.readthedocs.io/en/latest/signals.html .. _waitSignals: https://pytest-qt.readthedocs.io/en/latest/signals.html .. _Exceptions in virtual methods and slots: https://pytest-qt.readthedocs.io/en/latest/virtual_methods.html

Requirements

Since version 4.0.0, pytest-qt requires Python 3.6+.

Works with either PyQt5_ or PySide2_, picking whichever is available on the system, giving preference to the first one installed in this order:

  • PySide2
  • PyQt5

To force a particular API, set the configuration variable qt_api in your pytest.ini file to pyqt5 or pyside2:

.. code-block:: ini

[pytest]
qt_api=pyqt5

Alternatively, you can set the PYTEST_QT_API environment variable to the same values described above (the environment variable wins over the configuration if both are set).

Documentation

Full documentation and tutorial available at Read the Docs_.

.. _Read The Docs: https://pytest-qt.readthedocs.io

Change Log

Please consult the changelog page_.

.. _changelog page: https://pytest-qt.readthedocs.io/en/latest/changelog.html

Bugs/Requests

Please report any issues or feature requests in the issue tracker_.

.. _issue tracker: https://github.com/pytest-dev/pytest-qt/issues

Contributing

Contributions are welcome, so feel free to submit a bug or feature request.

Pull requests are highly appreciated! If you can, include some tests that exercise the new code or test that a bug has been fixed, and make sure to include yourself in the contributors list. :)

To prepare your environment, create a virtual environment and install pytest-qt in editable mode with dev extras::

$ pip install --editable .[dev]

After that install pre-commit for pre-commit checks::

$ pre-commit install

Running tests

Tests are run using tox_::

$ tox -e py37-pyside2,py37-pyqt5

pytest-qt is formatted using black <https://github.com/ambv/black>_ and uses pre-commit <https://github.com/pre-commit/pre-commit>_ for linting checks before commits. You can install pre-commit locally with::

$ pip install pre-commit
$ pre-commit install

Related projects

  • pytest-xvfb <https://github.com/The-Compiler/pytest-xvfb/>_ allows to run a virtual xserver (Xvfb) on Linux to avoid GUI elements popping up on the screen or for easy CI testing
  • pytest-qml <https://github.com/jgirardet/pytest-qml>_ allows running QML tests from pytest

Contributors

Many thanks to:

  • Igor T. Ghisi (@itghisi <https://github.com/itghisi>_);
  • John David Reaver (@jdreaver <https://github.com/jdreaver>_);
  • Benjamin Hedrich (@bh <https://github.com/bh>_);
  • Benjamin Audren (@baudren <https://github.com/baudren>_);
  • Fabio Zadrozny (@fabioz <https://github.com/fabioz>_);
  • Datalyze Solutions (@datalyze-solutions <https://github.com/datalyze-solutions>_);
  • Florian Bruhin (@The-Compiler <https://github.com/The-Compiler>_);
  • Guilherme Quentel Melo (@gqmelo <https://github.com/gqmelo>_);
  • Francesco Montesano (@montefra <https://github.com/montefra>_);
  • Roman Yurchak (@rth <https://github.com/rth>_)
  • Christian Karl (@karlch <https://github.com/karlch>_)

Powered by

.. |pycharm| image:: https://www.jetbrains.com/pycharm/docs/logo_pycharm.png :target: https://www.jetbrains.com/pycharm

.. |pydev| image:: http://www.pydev.org/images/pydev_banner3.png :target: https://www.pydev.org

|pycharm|

|pydev|

.. _tox: https://tox.readthedocs.io

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].