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.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_qgis-1.0.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file pytest-qgis-1.0.0.tar.gz.

File metadata

  • Download URL: pytest-qgis-1.0.0.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.7

File hashes

Hashes for pytest-qgis-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1e65dc5989d46a4697c0422741c1f6097c324e52f5b186e9e42b14c8481d03c3
MD5 2d23a7f2d6352f562b707e94c083c4c7
BLAKE2b-256 39b65497a53022c03010a76db0c158ed680d18092c85ebc524de20fde91c0325

See more details on using hashes here.

File details

Details for the file pytest_qgis-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_qgis-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.7

File hashes

Hashes for pytest_qgis-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3cb8a13dffc07a4f338c905626da5907e83e4b7cab7c1311619fe1ebd8798f35
MD5 4c73d6e969593c41c71f702521f08634
BLAKE2b-256 d6028a433416468490c387b15254d728ec6fe6635762ea2a7f8262b922ed4f11

See more details on using hashes here.

Supported by

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