Skip to content

sample pyqt applications with pylint, pytest-qt, and code coverage

License

Notifications You must be signed in to change notification settings

mkinney/pytest-qt-example

Repository files navigation

Simple example using pytest-qt

CI codecov

To setup

Run the following commands to setup a python virtual environment, install the requirements int and set the execution flag on the two sample scripts.

python3 -m venv venv
venv/bin/activate
pip install -r requirements.txt
chmod +x hello.py
chmod +x messageboxex.py

To run the test apps

./hello.py

or

./messageboxex.py

To test

pytest

Example output:

% pytest -s -vv
================================================================ test session starts =================================================================
platform darwin -- Python 3.9.9, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /nix/code/pytest-qt-example/venv/bin/python3.9
cachedir: .pytest_cache
PySide6 6.2.3 -- Qt runtime 6.2.3 -- Qt compiled 6.2.3
rootdir: /nix/code/pytest-qt-example
plugins: qt-4.0.2
collected 6 items

test_hello.py::test_hello PASSED
test_messageboxex.py::test_about_clicked PASSED
test_messageboxex.py::test_warning_clicked PASSED
test_messageboxex.py::test_info_clicked PASSED
test_messageboxex.py::test_like_clicked_yes PASSED
test_messageboxex.py::test_like_clicked_no PASSED

================================================================= 6 passed in 0.39s ==================================================================

To run a code coverage report for messageboxex

pytest --cov-report html --cov messageboxex

About

sample pyqt applications with pylint, pytest-qt, and code coverage

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published