Skip to main content

A pytest plugin for testing QGIS python plugins

Project description

pytest-qgis

PyPI version CI Code on Github Code style: black Imports: isort pre-commit

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:

  • qgis_app initializes and returns fully configured QgsApplication. This fixture is called automatically on the start of pytest session.
  • qgis_canvas initializes and returns QgsMapCanvas
  • qgis_iface returns mocked QgsInterface
  • new_project makes sure that all the map layers and configurations are removed. This should be used with tests that add stuff to QgsProject.

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


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-0.1.0.tar.gz (13.2 kB view hashes)

Uploaded source

Built Distribution

pytest_qgis-0.1.0-py3-none-any.whl (13.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page