Skip to main content

A pytest plugin for testing QGIS python plugins

Project description

pytest-qgis

PyPI version Downloads 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.
  • qgis_processing initializes the processing framework. This can be used when testing code that calls processing.run(...).

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

Uploaded Source

Built Distribution

pytest_qgis-1.0.2-py3-none-any.whl (15.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page