skillfed

pytest-flake8

pytest plugin to check FLAKE8 requirements

pytest-flake8 v1.3.0 506.3K downloads/30d#6,287 on PyPI1
Permissive license Active released

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-flake8

uv

uv add pytest-flake8

poetry

poetry add pytest-flake8

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software DevelopmentTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: Testing

Tags

pytest flake8 pluginpep8 compliance testingcode style checking pytestflake8 test integrationpython linting in testsautomated code quality checks
lintingcode-qualitypytest-plugin

More Software Development packages