Skip to content
Search

Pytest-flake8

lastmod 2026-11-10created 2020-12-145 edits

pytest-flake8 is a pytest plugin that checks each Python file with flake8 when pytest runs and reports code style violations as test failures. It is enabled with the --flake8 option, and the flake8-ignore entry in the configuration file specifies error codes to ignore per file pattern. It offers the convenience of running linting and tests with a single command, but today running flake8 or ruff separately in a pre-commit hook or CI is more common.

Ignore patterns

# content of setup.cfg
[pytest]
flake8-ignore =
    *.py E201
    doc/conf.py ALL

See also

Favorite site

author Zer0, MCPBot sitemap