$npx skillfedfor your agent

pytest-threadleak

Detects thread leaks

With conditionsPyPI TestingReleased Jul 2022240.7K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_threadleak-0.5.0-py3-none-any.whl
v0.5.0 · released 2022-07-03 · 1 runtime deps: pytest

Yes, if you need to catch thread leaks in your tests. The plugin is simple, low-friction, and has no known vulnerabilities. However, be aware that maintenance is dormant; verify compatibility with your pytest and Python versions before relying on it in a critical pipeline. For most projects, the benefit of catching thread leaks outweighs the maintenance risk.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction; depends only on pytest.
  • Maintenance is dormant—last release was 2022-07-03, though the repository remains active and has not been archived.

License · maintenance · safety

MIT (permissive) — MIT license (permissive); you may use, modify, and distribute this software freely with minimal restrictions.

last release 2022-07-03 (1503 days) · last repo commit 2024-09-01 · 11 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 240,664 downloads/mo, #8,902 on PyPI

Verify before relying

pip install pytest-threadleak

# In your test file or pytest.ini:
# pytest.ini:
# [pytest]
# threadleak = True

# Then run:
# pytest --threadleak your_test.py
  • Whether the plugin works correctly with modern pytest versions given the last release was 2022-07-03.
  • Whether thread exclusion patterns (threadleak_exclude) work as documented with current Python threading internals.
  • Performance impact when running large test suites with threadleak enabled.
Same gist for agents: .md · .json

What it is and what it does

pytest-threadleak is a pytest plugin that automatically detects when a test leaves threads running after it completes. It works by checking for leaked threads after each test and failing the test if any are found. You can enable it globally via pytest.ini, per-test using the @pytest.mark.threadleak decorator, or per-module. The plugin also supports excluding specific threads by regex pattern if certain background threads are expected.

The plugin helps catch both test bugs (tests that spawn threads without cleaning them up) and issues in the code being tested (libraries that leak threads). It integrates seamlessly into your pytest workflow and requires no changes to test code beyond optionally adding markers or configuration.

Use it for

  • Catch tests that spawn background threads without properly joining or stopping them before test completion.
  • Detect thread leaks in libraries under test that may cause resource exhaustion or test isolation problems.
  • Enforce thread cleanup discipline across a test suite by enabling threadleak globally in pytest configuration.
  • Exclude known background threads (e.g., connection pools) from leak detection using regex patterns.
  • Debug test flakiness caused by threads from previous tests interfering with subsequent tests.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need to catch thread leaks in your tests.

The plugin is simple, low-friction, and has no known vulnerabilities. However, be aware that maintenance is dormant; verify compatibility with your pytest and Python versions before relying on it in a critical pipeline. For most projects, the benefit of catching thread leaks outweighs the maintenance risk.

Install

pytest-threadleak on PyPI

Before you install

Low install friction; depends only on pytest. Maintenance is dormant—last release was 2022-07-03, though the repository remains active and has not been archived.

License in practice

MIT license (permissive); you may use, modify, and distribute this software freely with minimal restrictions.

Quickstart

pip install pytest-threadleak

# In your test file or pytest.ini:
# pytest.ini:
# [pytest]
# threadleak = True

# Then run:
# pytest --threadleak your_test.py

Verify before relying

  • Whether the plugin works correctly with modern pytest versions given the last release was 2022-07-03.
  • Whether thread exclusion patterns (threadleak_exclude) work as documented with current Python threading internals.
  • Performance impact when running large test suites with threadleak enabled.

Package facts

LicenseMIT permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
pytest
MaintenanceDormant 1,503 days since the last release
Last repo commit
First released
Downloads240,664 / month, #8,902 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Evidence: pytest_threadleak-0.5.0-py3-none-any.whl

Tags

Capabilities
pytest thread leak detectiondetect leaking threads in testspytest plugin thread cleanupthread leak testingpytest thread monitoringtest thread validationpytest thread safety check
Topics
pytest-pluginthread-safetytest-quality

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 › “pytest thread leak detection”

  • pytest-threadleakA pytest plugin that detects when tests leak threads—threads that…
  • pyleakDetects leaked asyncio tasks, threads, and event loop blocking in…
  • pytest-reraiseCaptures exceptions raised in threads during pytest tests and…

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

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.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

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.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

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.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

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.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

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.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also pytest-logging · pyleak · pytest-custom-exit-code · pytest-run-parallel · pytest-flakefinder · pytest-find-dependencies · pytest-monitor · pytest-replay · pytest-timeout · pytest-race