{"id":13936789,"url":"https://github.com/pytest-dev/pytest-qt","last_synced_at":"2025-05-14T09:12:41.055Z","repository":{"id":7146727,"uuid":"8444568","full_name":"pytest-dev/pytest-qt","owner":"pytest-dev","description":"pytest plugin for Qt (PyQt5/PyQt6 and PySide2/PySide6) application testing","archived":false,"fork":false,"pushed_at":"2025-05-08T11:40:24.000Z","size":1294,"stargazers_count":430,"open_issues_count":43,"forks_count":69,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-05-10T00:03:15.239Z","etag":null,"topics":["hacktoberfest","pytest","qt"],"latest_commit_sha":null,"homepage":"https://pytest-qt.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pytest-dev.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["The-Compiler","nicoddemus"]}},"created_at":"2013-02-26T23:33:46.000Z","updated_at":"2025-05-08T11:40:26.000Z","dependencies_parsed_at":"2023-02-14T16:35:16.498Z","dependency_job_id":"ace02968-f570-4fd1-9bcf-072b833cba5c","html_url":"https://github.com/pytest-dev/pytest-qt","commit_stats":{"total_commits":912,"total_committers":47,"mean_commits":"19.404255319148938","dds":"0.42872807017543857","last_synced_commit":"9ccd999127ea1815d3232471a2dfe0702b1ad5b9"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytest-dev%2Fpytest-qt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytest-dev%2Fpytest-qt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytest-dev%2Fpytest-qt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytest-dev%2Fpytest-qt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pytest-dev","download_url":"https://codeload.github.com/pytest-dev/pytest-qt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110377,"owners_count":22016391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","pytest","qt"],"created_at":"2024-08-07T23:03:00.031Z","updated_at":"2025-05-14T09:12:41.027Z","avatar_url":"https://github.com/pytest-dev.png","language":"Python","readme":"=========\npytest-qt\n=========\n\npytest-qt is a `pytest`_ plugin that allows programmers to write tests\nfor `PyQt5`_, `PyQt6`_, and `PySide6`_ applications.\n\nThe main usage is to use the ``qtbot`` fixture, responsible for handling ``qApp``\ncreation as needed and provides methods to simulate user interaction,\nlike key presses and mouse clicks:\n\n\n.. code-block:: python\n\n    def test_hello(qtbot):\n        widget = HelloWidget()\n        qtbot.addWidget(widget)\n\n        # click in the Greet button and make sure it updates the appropriate label\n        qtbot.mouseClick(widget.button_greet, qt_api.QtCore.Qt.MouseButton.LeftButton)\n\n        assert widget.greet_label.text() == \"Hello!\"\n\n\n.. _PySide6: https://pypi.org/project/PySide6/\n.. _PyQt5: https://pypi.org/project/PyQt5/\n.. _PyQt6: https://pypi.org/project/PyQt6/\n.. _pytest: http://pytest.org\n\nThis allows you to test and make sure your view layer is behaving the way you expect after each code change.\n\n.. |version| image:: http://img.shields.io/pypi/v/pytest-qt.svg\n  :target: https://pypi.python.org/pypi/pytest-qt\n\n.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/pytest-qt.svg\n    :target: https://anaconda.org/conda-forge/pytest-qt\n\n.. |ci| image:: https://github.com/pytest-dev/pytest-qt/workflows/test/badge.svg\n  :target: https://github.com/pytest-dev/pytest-qt/actions\n\n.. |coverage| image:: http://img.shields.io/coveralls/pytest-dev/pytest-qt.svg\n  :target: https://coveralls.io/r/pytest-dev/pytest-qt\n\n.. |docs| image:: https://readthedocs.org/projects/pytest-qt/badge/?version=latest\n  :target: https://pytest-qt.readthedocs.io\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/pytest-qt.svg\n  :target: https://pypi.python.org/pypi/pytest-qt/\n  :alt: Supported Python versions\n\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n  :target: https://github.com/ambv/black\n\n|python| |version| |conda-forge| |ci| |coverage| |docs| |black|\n\n\nFeatures\n========\n\n- `qtbot`_ fixture to simulate user interaction with ``Qt`` widgets.\n- `Automatic capture`_ of ``qDebug``, ``qWarning`` and ``qCritical`` messages;\n- waitSignal_ and waitSignals_ functions to block test execution until specific\n  signals are emitted.\n- `Exceptions in virtual methods and slots`_ are automatically captured and\n  fail tests accordingly.\n\n.. _qtbot: https://pytest-qt.readthedocs.io/en/latest/reference.html#module-pytestqt.qtbot\n.. _Automatic capture: https://pytest-qt.readthedocs.io/en/latest/logging.html\n.. _waitSignal: https://pytest-qt.readthedocs.io/en/latest/signals.html\n.. _waitSignals: https://pytest-qt.readthedocs.io/en/latest/signals.html\n.. _Exceptions in virtual methods and slots: https://pytest-qt.readthedocs.io/en/latest/virtual_methods.html\n\nRequirements\n============\n\nWorks with either PySide6_, PyQt6_ or PyQt5_.\n\nIf any of the above libraries is already imported by the time the tests execute, that library will be used.\n\nIf not, pytest-qt will try to import and use the Qt APIs, in this order:\n\n- ``PySide6``\n- ``PyQt6``\n- ``PyQt5``\n\nTo force a particular API, set the configuration variable ``qt_api`` in your ``pytest.ini`` file to\n``pyside6``, ``pyqt6`` or ``pyqt5``:\n\n.. code-block:: ini\n\n    [pytest]\n    qt_api=pyqt6\n\n\nAlternatively, you can set the ``PYTEST_QT_API`` environment\nvariable to the same values described above (the environment variable wins over the configuration\nif both are set).\n\n\nDocumentation\n=============\n\nFull documentation and tutorial available at `Read the Docs`_.\n\n.. _Read The Docs: https://pytest-qt.readthedocs.io\n\nChange Log\n==========\n\nPlease consult the `changelog page`_.\n\n.. _changelog page: https://pytest-qt.readthedocs.io/en/latest/changelog.html\n\nBugs/Requests\n=============\n\nPlease report any issues or feature requests in the `issue tracker`_.\n\n.. _issue tracker: https://github.com/pytest-dev/pytest-qt/issues\n\nContributing\n============\n\nContributions are welcome, so feel free to submit a bug or feature\nrequest.\n\nPull requests are highly appreciated! If you\ncan, include some tests that exercise the new code or test that a bug has been\nfixed, and make sure to include yourself in the contributors list. :)\n\nTo prepare your environment, create a virtual environment and install ``pytest-qt`` in editable mode with ``dev``\nextras::\n\n    $ pip install --editable .[dev]\n\nAfter that install ``pre-commit`` for pre-commit checks::\n\n    $ pre-commit install\n\nRunning tests\n-------------\n\nTests are run using `tox`_::\n\n    $ tox -e py-pyside6,py-pyqt5\n\n``pytest-qt`` is formatted using `black \u003chttps://github.com/ambv/black\u003e`_ and uses\n`pre-commit \u003chttps://github.com/pre-commit/pre-commit\u003e`_ for linting checks before commits. You\ncan install ``pre-commit`` locally with::\n\n    $ pip install pre-commit\n    $ pre-commit install\n\nRelated projects\n----------------\n\n- `pytest-xvfb \u003chttps://github.com/The-Compiler/pytest-xvfb/\u003e`_ allows to run a virtual xserver (Xvfb) on Linux to avoid GUI elements popping up on the screen or for easy CI testing\n- `pytest-qml \u003chttps://github.com/jgirardet/pytest-qml\u003e`_ allows running QML tests from pytest\n\nContributors\n------------\n\nMany thanks to:\n\n- Igor T. Ghisi (`@itghisi \u003chttps://github.com/itghisi\u003e`_);\n- John David Reaver (`@jdreaver \u003chttps://github.com/jdreaver\u003e`_);\n- Benjamin Hedrich (`@bh \u003chttps://github.com/bh\u003e`_);\n- Benjamin Audren (`@baudren \u003chttps://github.com/baudren\u003e`_);\n- Fabio Zadrozny (`@fabioz \u003chttps://github.com/fabioz\u003e`_);\n- Datalyze Solutions (`@datalyze-solutions \u003chttps://github.com/datalyze-solutions\u003e`_);\n- Florian Bruhin (`@The-Compiler \u003chttps://github.com/The-Compiler\u003e`_);\n- Guilherme Quentel Melo (`@gqmelo \u003chttps://github.com/gqmelo\u003e`_);\n- Francesco Montesano (`@montefra \u003chttps://github.com/montefra\u003e`_);\n- Roman Yurchak (`@rth \u003chttps://github.com/rth\u003e`_)\n- Christian Karl (`@karlch \u003chttps://github.com/karlch\u003e`_)\n\n**Powered by**\n\n.. |pycharm| image:: https://resources.jetbrains.com/storage/products/company/brand/logos/PyCharm.png\n  :target: https://www.jetbrains.com/pycharm\n  :width: 400\n\n.. |pydev| image:: http://www.pydev.org/images/pydev_banner3.png\n  :target: https://www.pydev.org\n\n|pycharm|\n\n|pydev|\n\n.. _tox: https://tox.readthedocs.io\n","funding_links":["https://github.com/sponsors/The-Compiler","https://github.com/sponsors/nicoddemus"],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpytest-dev%2Fpytest-qt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpytest-dev%2Fpytest-qt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpytest-dev%2Fpytest-qt/lists"}