Metadata-Version: 2.1
Name: pytest-unused-fixtures
Version: 0.1.0
Summary: A pytest plugin to list unused fixtures after a test run.
License: MIT
Author: Mikuláš Poul
Author-email: mikulaspoul@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Testing
Requires-Dist: pytest (>=7.3.2,<8.0.0)
Description-Content-Type: text/markdown

# 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

```shell
$ 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](https://python-poetry.org/) (dependencies) and [pre-commit](https://pre-commit.com/) (coding standards) are required for development. Ther are some tests, obviously written in [pytest](https://pytest.org/).

```shell
$ poetry install
$ pre-commit install
$ pytest tests
```

## Thanks

Many thanks to

 - [pytest-deadfixtures](https://github.com/jllorencetti/pytest-deadfixtures) for inspiration for this project
 - [pytest-durations](https://github.com/blake-r/pytest-durations) for inspirations in parts of the implementation

## Changelog

### 0.1.0 (Jun 14, 2023)

* First Release

