Skip to main content

A pytest plugin to list unused fixtures after a test run.

Project description

pytest-unused-fixtures

A pytest plugin to list unused fixtures after a test run.

The plugin watches all fixtures which are used in a test run, and then compares it to all the fixtures available in the same test collection. It then prints out all the fixtures which were not used, groupped by where they were defined.

Running the tests is required to accurately record which fixtures are used, as pytest provides ways of dynamically requesting fixtures, and pure static analysis will not catch those.

Installation

$ pip install pytest-unused-fixtures

Usage

After installing the package, the plugin is enabled by adding the switch --unused-fixtures.

Paths of fixtures can be ignored with one or multiple --unused-fixtures-ignore-path arguments. For example --unused-fixtures-ignore-path=venv will ignore all fixtures defined in the venv folder.

Development

Poetry (dependencies) and pre-commit (coding standards) are required for development. Ther are some tests, obviously written in pytest.

$ poetry install
$ pre-commit install
$ pytest tests

Thanks

Many thanks to

Changelog

0.1.0 (Jun 14, 2023)

  • First Release

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_unused_fixtures-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

pytest_unused_fixtures-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest_unused_fixtures-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_unused_fixtures-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.10.11 Linux/6.3.6-100.fc37.x86_64

File hashes

Hashes for pytest_unused_fixtures-0.1.0.tar.gz
Algorithm Hash digest
SHA256 04d480f11256c8567437a820b9a1ba296695d5720241ff48319cf15c1631aad9
MD5 9ec56c856ebf565da53a2b7b53fed50c
BLAKE2b-256 2a4bcdcac16f9f9e628f9a78c243ca57e7255d265bd2bc39bf53007e0ed23d5a

See more details on using hashes here.

Provenance

File details

Details for the file pytest_unused_fixtures-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_unused_fixtures-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9af7f4b5d7bb42c8a5fa2908f0b2b54c37fd32363b1d1d18c3aa461846b32d3
MD5 63e65ff9888ce90022a36aa0bd301637
BLAKE2b-256 86557dcb4ca1dadbdc31ab3636c8233a3641818b5e40ae4e02b491bbfebbef7c

See more details on using hashes here.

Provenance

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