A pytest plugin for testing QGIS python plugins
Project description
pytest-qgis
A pytest plugin for testing QGIS python plugins.
Features
This plugin makes it easier to write QGIS plugin tests with the help of some fixtures and hooks:
Fixtures
qgis_app
returns and eventually exits fully configuredQgsApplication
. This fixture is called automatically on the start of pytest session.qgis_canvas
returnsQgsMapCanvas
.qgis_iface
returns stubbedQgsInterface
new_project
makes sure that all the map layers and configurations are removed. This should be used with tests that add stuff toQgsProject
.qgis_processing
initializes the processing framework. This can be used when testing code that callsprocessing.run(...)
.
Hooks
pytest_configure
hook is used to initialize and configureQgsApplication
. With QGIS >= 3.18 it is also used to patchqgis.utils.iface
withqgis_iface
automatically.
Requirements
This pytest plugin requires QGIS >= 3.10 to work.
Installation
Install with pip
:
pip install pytest-qgis
Contributing
Contributions are very welcome.
License
Distributed under the terms of the GNU GPL v2.0
license, "pytest-qgis" is free and open source software.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest-qgis-1.0.3.tar.gz
(19.0 kB
view hashes)
Built Distribution
Close
Hashes for pytest_qgis-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d45ad897dbd760235bb0c00cc5e0ca1a8b563b365fa6342bcf80469e6228a25 |
|
MD5 | 3d06d69c4010ad5a5174b351c6f15635 |
|
BLAKE2b-256 | d3b5380bddce6fcd4714e637536d1abd4b1970303f57d349cda54c7c2941456c |