skillfed

pytest-deadfixtures

A simple plugin to list unused fixtures in pytest

pytest-deadfixtures v3.1.0 1.0M downloads/30d#4,490 on PyPI166
Permissive license MIT AGING released

What it is and what it does

pytest-deadfixtures is a pytest plugin that analyzes your test suite to report fixtures that are never used and fixtures that may be duplicated. It runs as a separate pytest invocation with command-line flags and does not execute your tests during analysis, making it suitable for CI pipelines when run after the main test suite.

The plugin offers three main features: listing unused fixtures with their location and docstring, identifying potentially duplicate fixtures by comparing return values, and ignoring specific fixtures via a @deadfixtures_ignore decorator. It's designed as a code-quality tool to help maintain lean test suites by surfacing fixture debt.

Use it for:

  • Audit an existing test suite to find fixtures defined but never referenced by any test.
  • Detect duplicate fixture definitions that provide the same test data or setup, reducing maintenance burden.
  • Integrate into CI to enforce fixture hygiene by running --dead-fixtures after the main test suite passes.
  • Mark intentionally unused fixtures with @deadfixtures_ignore to exclude them from reports without removing them.
  • Review fixture usage patterns with verbose output to understand which fixtures are actually exercised.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pytest plugin that identifies unused and duplicated fixtures in your test suite, helping you clean up test code and catch redundant fixture definitions.

Yes, if you maintain a pytest suite and want to identify fixture bloat. The plugin is stable, has no security vulnerabilities, and low install friction. The aging maintenance status (211 days since last release) is a minor concern but not a blocker—the package is not archived and works with modern Python versions. Use it as a periodic audit tool rather than a blocking CI gate.

Install

pytest-deadfixtures on PyPI

pip

pip install pytest-deadfixtures

uv

uv add pytest-deadfixtures

poetry

poetry add pytest-deadfixtures

Installing pytest-deadfixtures

Before you install

Low install friction with a single runtime dependency on pytest. Maintenance status is aging—last release was 211 days ago—but the repository is not archived and the package is marked Production/Stable.

License in practice

MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install pytest-deadfixtures

# In your test directory, run:
pytest --dead-fixtures

# To find duplicates:
pytest --dup-fixtures

Verify before relying

  • Whether the aging maintenance status (211 days since last release) affects compatibility with the latest pytest versions.
  • How the duplicate detection handles fixtures with falsy return values, beyond the documented skip behavior.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — pytest
Maintenance aging — 211 days since the last release
Last repo commit
First released
Downloads 1,021,674/month — #4,490 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest_deadfixtures-3.1.0-py2.py3-none-any.whl

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Tags

pytest unused fixturesfind dead fixturesduplicate fixtures detectionpytest fixture cleanuptest fixture analysispytest code qualityfixture linting
pytest-plugintest-qualityfixture-analysis

More Testing packages