Registry / testing / pytest-unused-fixtures

pytest-unused-fixtures

JSON →
library0.3.1pypypi✓ verified 86d ago

A pytest plugin that lists fixtures defined but not used in a test run. Useful for keeping test suites clean. Current version: 0.3.1. Requires Python >=3.9. Maintained, release cadence is irregular.

pip install pytest-unused-fixtures
INSTALL
IMPORT
SIG · PYTEST-UNUSED-FIXT
P
pytest-unused-fixtures
testingpythonv0.3.1
Install
2.8s avg
Import
410ms
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.434s · 30.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.8s · import 0.386s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ignore_unused_fixture
from pytest_unused_fixtures import ignore_unused_fixture
Exposed as a public symbol since v0.3.0.

Basic usage: define fixtures, run `pytest --unused-fixtures`, and optionally ignore specific ones.

import pytest # conftest.py or test file @pytest.fixture def used_fixture(): return 1 @pytest.fixture def unused_fixture(): return 2 def test_foo(used_fixture): assert used_fixture == 1 # Run pytest --unused-fixtures to see 'unused_fixture' listed. # To ignore a fixture from this check, decorate with @ignore_unused_fixture
pytest --version
Debug
Known issues
gotchaThe plugin only reports fixtures that are defined in the same session but never requested. Fixtures from installed packages (e.g., built-in plugins) are not considered unless they are explicitly loaded.
fix
Ensure your fixture is defined in the test suite (e.g., conftest.py or test module).
affects: all
breakingIn v0.3.0, the default value of `available_fixtures` changed from `None` to an empty set. If you were relying on `None` in custom code that uses the plugin's internals, your code may break.
fix
Update your custom checks to handle an empty set instead of `None`.
affects: >=0.3.0
deprecatedThe `--unused-fixtures` CLI option is the only interface. No deprecated options exist as of v0.3.1.
fix
No action needed.
affects: all
Errors
Common errors & fixes
AttributeError: module 'pytest_unused_fixtures' has no attribute 'ignore_unused_fixture'
Using an older version (<0.3.0) that does not have the `ignore_unused_fixture` decorator.
fix
Upgrade to 0.3.0 or later: `pip install --upgrade pytest-unused-fixtures`
Fixtures imported from third-party packages appear as unused
The plugin only captures fixtures defined in the test suite, not fixtures from installed plugins or conftest.py of other packages.
fix
This is expected behavior. Use `@ignore_unused_fixture` on fixtures you don't want flagged.
Upgrade
Version history
0.3.1latest on PyPI · released Dec 23, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Resources
pytest-unused-fixtures — pip install pytest-unused-fixtures · libregistry