detect-test-pollution
a tool to detect test pollution
Decision gist · record as of 2026-08-14
Yes. If you maintain a pytest suite and have encountered flaky tests or test-order sensitivity, this tool directly solves a hard debugging problem with low friction and no dependencies. Even if you haven't hit the problem yet, it's lightweight enough to keep on hand. No security concerns, active maintenance, and permissive license.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires pytest to be installed and your tests to be runnable via pytest; requires Python >=3.8.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained as of July 2026 with 205 repository stars.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2023-09-28 (1051 days) · last repo commit 2026-07-15 · 205 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 324,318 downloads/mo, #7,596 on PyPI
Alternatives
Verify before relying
pip install detect-test-pollution
detect-test-pollution \
--failing-test test.py::test_id_here \
--tests ./tests- Effectiveness on very large test suites (thousands of tests) and whether bisection time remains practical.
- Whether the tool handles parametrized tests, fixtures with side effects, or async test pollution.
- Support for pytest plugins that affect test ordering or isolation (e.g., pytest-xdist in worker mode).
What it is and what it does
detect-test-pollution is a command-line tool that finds which test is polluting another test when test order matters. Test pollution occurs when a test fails mysteriously in one order but passes when run alone—a common flake symptom. The tool works by bisecting your test suite: given a failing test, it repeatedly runs subsets of your other tests alongside it to narrow down which test causes the failure. It supports two modes: normal detection (when you've identified a failing test) and fuzzing (shuffling tests until a failure appears, then finding its cause).
The tool is pytest-specific and requires your tests to be discoverable and runnable via pytest. It has no runtime dependencies beyond Python itself, making installation and setup straightforward. Bisection typically completes in logarithmic steps relative to your test count, so even large suites can be debugged in reasonable time.
Use it for
- Isolate the root cause of a flaky test that fails in CI but passes locally or when run in isolation.
- Debug test suites where pytest-randomly or pytest-xdist expose hidden test interdependencies.
- Fuzz a test suite to discover latent pollution before it causes production issues.
- Identify global state mutations (module-level variables, mocked objects, database state) left behind by tests.
- Refactor or split a monolithic test file by finding which tests depend on execution order.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
If you maintain a pytest suite and have encountered flaky tests or test-order sensitivity, this tool directly solves a hard debugging problem with low friction and no dependencies. Even if you haven't hit the problem yet, it's lightweight enough to keep on hand. No security concerns, active maintenance, and permissive license.
Install
detect-test-pollution on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of July 2026 with 205 repository stars.
Requires pytest to be installed and your tests to be runnable via pytest; requires Python >=3.8.
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 detect-test-pollution
detect-test-pollution \
--failing-test test.py::test_id_here \
--tests ./tests
Verify before relying
- Effectiveness on very large test suites (thousands of tests) and whether bisection time remains practical.
- Whether the tool handles parametrized tests, fixtures with side effects, or async test pollution.
- Support for pytest plugins that affect test ordering or isolation (e.g., pytest-xdist in worker mode).
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 1,051 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 324,318 / month, #7,596 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: detect_test_pollution-1.2.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “test pollution detection”
- detect-test-pollutionDetects test pollution—failures caused by side effects from other…
- pytest-find-dependenciesA pytest plugin that identifies dependencies between tests by running…
- pytest-antilruClears functools.lru_cache between pytest test runs to prevent test…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also lib-detect-testenv · pytest-find-dependencies · pytest-sentry · pytest-retry · pytest-antilru · pytest-flakefinder · pytest-pretty · pytest-assume · pytest-ruff · pylint-pytest