pytest-flake8
pytest plugin to check FLAKE8 requirements
What it is and what it does
pytest-flake8 is a pytest plugin that integrates PEP8 style checking directly into your test suite. When you run pytest with the --flake8 flag, it automatically discovers all .py files in your project and checks them against flake8 rules, reporting style violations as test failures. This lets you enforce code quality standards alongside your functional tests.
The plugin caches results and only re-checks modified files by default, which speeds up repeated test runs. You can configure which errors or warnings to ignore on a per-project or per-file basis using standard flake8 configuration. If you have flake8 plugins installed, they are automatically applied without additional setup.
Use it for:
- Enforce PEP8 compliance in CI/CD pipelines by failing builds when style violations are detected
- Run code quality checks alongside unit tests to catch style issues early in development
- Configure project-specific or file-specific style rules using flake8's standard configuration
- Integrate linting into existing pytest workflows without adding separate tool invocations
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that runs flake8 PEP8 compliance checks on Python files as part of your test suite, discovering and checking every .py file automatically.
Yes. Low friction to install, actively maintained, no known vulnerabilities, and permissive licensing. Use it if you want PEP8 compliance checks as part of your pytest suite and prefer integrated tooling over separate linting steps.
Install
pytest-flake8 on PyPI
pip
pip install pytest-flake8uv
uv add pytest-flake8poetry
poetry add pytest-flake8Installing pytest-flake8
Before you install
Low install friction with only two runtime dependencies (flake8 and pytest). Actively maintained as of April 2026, with stable production status since its initial release.
License in practice
Licensed under MIT (permissive), so you can use and modify it freely in commercial or private projects with minimal restrictions.
Quickstart
pip install pytest-flake8
pytest --flake8
Requires Python 3.9 or later; flake8 and pytest must be installed in your test environment.
Verify before relying
- Whether optional flake8 plugins are auto-detected and applied without manual configuration
- How caching behavior interacts with CI/CD pipelines and whether cache-clear is needed regularly
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — flake8, pytest |
| Maintenance | actively maintained — 643 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 506,312/month — #6,287 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_flake8-1.3.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pytest-mypyIntegrates mypy static type checking into…
permissive · top 15,000 on PyPI
pytest-pep8A pytest plugin that integrates PEP8 style…
permissive · top 15,000 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
pep8-namingA flake8 plugin that checks Python code for…
permissive · top 5,000 on PyPI
flake8-polyfillProvides compatibility helpers for Flake8…
permissive · top 5,000 on PyPI
flake8-tupleA flake8 plugin that detects unintended…
permissive · top 15,000 on PyPI
pep8Checks Python code against PEP 8 style…
permissive · top 5,000 on PyPI
flake8-printA flake8 plugin that detects print statements…
permissive · top 5,000 on PyPI
pycodestylepycodestyle checks Python code against PEP 8…
permissive · top 1,000 on PyPI
cementCement is a Python application framework…
permissive · top 15,000 on PyPI