skillfed

pytest-find-dependencies

A pytest plugin to find dependencies between tests

pytest-find-dependencies v0.6.0 983.2K downloads/30d#4,582 on PyPI5
Permissive license MIT Active released

What it is and what it does

pytest-find-dependencies is a pytest plugin that automates the detection of test interdependencies—situations where one test's success or failure depends on the execution of another test. Tests should ideally be independent, but in practice many codebases accumulate hidden dependencies that only surface when test order changes. This plugin runs your test suite in both forward and reverse order, then uses binary search on any failing tests to isolate the specific test causing the failure.

The plugin reports found dependencies clearly and can also flag tests that fail permanently after all tests run, indicating environmental side effects that weren't cleaned up. It integrates with pytest's command-line interface via the `--find-dependencies` flag and supports options to run tests serially, ignore specific test markers, and control exit codes. It detects pytest-xdist and disables distribution for its internal test runs to preserve ordering.

Use it for:

  • Identify hidden test dependencies in a legacy test suite before refactoring or parallelizing tests.
  • Debug why tests pass in isolation but fail in a full run—pinpoint the offending test automatically.
  • Verify test cleanup: detect tests that leave permanent state changes (e.g., database records) affecting later tests.
  • Ensure test order independence before adopting parallel test runners like pytest-xdist.
  • Validate that test markers from ordering plugins (pytest-order, pytest-dependency) are working as intended.

Worth the install?

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

A pytest plugin that identifies dependencies between tests by running them in multiple orders and using binary search to pinpoint which test causes another to fail.

Yes. The plugin solves a real problem—hidden test dependencies are common and hard to find manually. It has low install friction, active maintenance, permissive licensing, no known vulnerabilities, and runs on modern Python versions. Use it if you suspect test interdependencies or want to verify test isolation before parallelizing; the runtime overhead is modest and the diagnostic value is high.

Install

pytest-find-dependencies on PyPI

pip

pip install pytest-find-dependencies

uv

uv add pytest-find-dependencies

poetry

poetry add pytest-find-dependencies

Installing pytest-find-dependencies

Before you install

Low install friction with a single runtime dependency on pytest. Actively maintained as of 2025-07-16 with recent commits; the repository is not archived and has received updates within the past year.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install pytest-find-dependencies

pytest --find-dependencies

# Output shows which tests depend on others, e.g.:
# test_one.py::test_b depends on test_one.py::test_e

Requires pytest to be installed; Python 3.9 or later.

Verify before relying

  • Whether the binary search approach reliably catches all test dependencies or only a subset in practice.
  • Performance impact on large test suites beyond the documented 1.5x to 2x slowdown estimates.
  • How well permanent environment changes (e.g., database state) are detected in parallel vs. serial mode.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — pytest
Maintenance actively maintained — 394 days since the last release
Last repo commit
First released
Downloads 983,229/month — #4,582 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest_find_dependencies-0.6.0-py3-none-any.whl

Keywords: testing, pytest, dependencies

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: Utilities

Tags

pytest test dependency detectionfind test order dependenciestest pollution detectionpytest test isolation checkeridentify dependent teststest interdependency analysis
test-isolationtest-debugging

More Utilities packages

idna

Converts domain names between Unicode and…

permissive · top 100 on PyPI

charset-normalizer

Detects and normalizes text encoding from…

permissive · top 100 on PyPI

setuptools

Setuptools is a Python build backend and…

permissive · top 100 on PyPI

pluggy

Pluggy provides a plugin system that lets you…

permissive · top 100 on PyPI

Pygments

Pygments is a syntax highlighter that colorizes…

permissive · top 100 on PyPI

six

Six provides utility functions to write Python…

permissive · top 100 on PyPI

detect-test-pollution

Detects test pollution—failures caused by side…

permissive · top 15,000 on PyPI

pytest-order

A pytest plugin that lets you control the order…

permissive · top 5,000 on PyPI

pytest-logging

A pytest plugin that configures Python logging…

permissive · top 15,000 on PyPI

pytest-reverse

A pytest plugin that runs tests in reverse…

permissive · top 15,000 on PyPI

pytest-flakefinder

A pytest plugin that runs tests multiple times…

permissive · top 5,000 on PyPI

pytest-timestamper

A pytest plugin that prefixes each test output…

unclear · top 15,000 on PyPI

pytest-randomly

A pytest plugin that randomly shuffles test…

permissive · top 5,000 on PyPI

pytest-error-for-skips

A pytest plugin that converts skipped tests…

permissive · top 15,000 on PyPI

pytest-helpers-namespace

Provides a pytest namespace for registering and…

permissive · top 15,000 on PyPI

pytest-dependency

A pytest plugin that marks tests as dependent…

permissive · top 5,000 on PyPI