pytest-black
A pytest plugin to enable format checking with black
Decision gist · record as of 2026-08-14
Yes, if you already use pytest and black and want formatting checks as part of your test suite. The low install friction and permissive license make it straightforward to add. However, the dormant maintenance status (last commit 2024-12-23, zero repository stars) and old Python support floor (>=3.5) suggest limited ongoing development; verify compatibility with your current black version before relying on it in production CI/CD.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires black 19.3b0 or later; requires pytest and toml as runtime dependencies.
- Low friction install with three straightforward dependencies (pytest, black, toml).
- Maintenance is dormant—last release was 2024-12-15 but no commits since 2024-12-23, and the repository shows zero stars, suggesting limited active community engagement.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) means you can use, modify, and distribute the package freely with minimal restrictions, typical for open-source development tools.
last release 2024-12-15 (607 days) · last repo commit 2024-12-23
0 known vulnerabilities (OSV.dev, 2026-08-14) · 157,185 downloads/mo, #10,762 on PyPI
Alternatives
Verify before relying
pip install pytest-black
# In your test run:
pytest --black
# Outputs formatting diffs without applying changes- Whether the plugin works correctly with recent black versions beyond 19.3b0.
- Current state of compatibility with modern Python 3.x versions (requires_python is >=3.5, which is quite old).
- Whether dormant maintenance status affects reliability in active CI/CD pipelines.
What it is and what it does
pytest-black is a pytest plugin that integrates black's code formatting checks into your test suite. When you run pytest with the --black flag, it scans your code and reports any formatting violations that black would fix, displaying a diff of suggested changes. The plugin does not modify your code—it only reports violations, leaving the decision to apply changes to you or your CI pipeline.
The plugin relies on pytest, black, and toml as runtime dependencies. It reads black configuration from pyproject.toml if present, allowing you to customize formatting rules per project. This makes it useful for enforcing consistent code style as part of automated testing rather than as a standalone formatter.
Use it for
- Enforce code formatting standards in CI/CD pipelines by failing tests when black violations are detected.
- Catch formatting inconsistencies during local development before pushing code to version control.
- Integrate style checking into existing pytest workflows without adding separate linting steps.
- Report formatting diffs to developers during test runs so they can see exactly what black would change.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you already use pytest and black and want formatting checks as part of your test suite.
The low install friction and permissive license make it straightforward to add. However, the dormant maintenance status (last commit 2024-12-23, zero repository stars) and old Python support floor (>=3.5) suggest limited ongoing development; verify compatibility with your current black version before relying on it in production CI/CD.
Install
pytest-black on PyPI
Before you install
Low friction install with three straightforward dependencies (pytest, black, toml). Maintenance is dormant—last release was 2024-12-15 but no commits since 2024-12-23, and the repository shows zero stars, suggesting limited active community engagement.
Requires black 19.3b0 or later; requires pytest and toml as runtime dependencies.
License in practice
MIT license (permissive) means you can use, modify, and distribute the package freely with minimal restrictions, typical for open-source development tools.
Quickstart
pip install pytest-black
# In your test run:
pytest --black
# Outputs formatting diffs without applying changes
Verify before relying
- Whether the plugin works correctly with recent black versions beyond 19.3b0.
- Current state of compatibility with modern Python 3.x versions (requires_python is >=3.5, which is quite old).
- Whether dormant maintenance status affects reliability in active CI/CD pipelines.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.5 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagespytestblacktoml |
| Maintenance | Dormant 607 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 157,185 / month, #10,762 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Software Development :: Testing |
Evidence: pytest_black-0.6.0-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 › “pytest black format checking”
- pytest-blackA pytest plugin that runs black format checks on your code during…
- pytest-examplesA pytest plugin that finds, lints, runs, and validates Python code…
- darkerDarker reformats Python source code in Git repositories, but only…
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 flake8-black · pytest-enabler · pytest-ruff · pytest-qt · jupyter-black · darker · pytest-antilru · black · tox-ansible · pytest-pspec