{"id":5427,"library":"pytest-flake8","title":"pytest-flake8","description":"pytest-flake8 is a pytest plugin that integrates flake8 into your test suite to check Python code against PEP8, PyFlakes, and McCabe complexity. As of version 1.3.0, it is actively maintained by coherent-oss with regular releases and supports Python >=3.9.","status":"active","version":"1.3.0","language":"en","source_language":"en","source_url":"https://github.com/coherent-oss/pytest-flake8","tags":["pytest","flake8","linter","code quality","testing","plugin"],"install":[{"cmd":"pip install pytest-flake8","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core testing framework, required for the plugin to function.","package":"pytest"},{"reason":"The static code analysis tool that this plugin integrates.","package":"flake8"},{"reason":"Requires Python >=3.9","package":"python","optional":false}],"imports":[],"quickstart":{"code":"# content of your_module.py\ndef long_line_function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12):\n    pass\n\n# content of setup.cfg or pyproject.toml\n# For setup.cfg:\n# [tool:pytest]\n# flake8-max-line-length = 79\n\n# For pyproject.toml (requires pytest>=6.0):\n# [tool.pytest.ini_options]\n# flake8-max-line-length = 79\n\n# Run pytest with flake8 checks\n# pytest --flake8 your_module.py","lang":"bash","description":"After installation, run `pytest --flake8` to execute flake8 checks on all discovered Python files. Configuration for pytest-flake8 specific options (e.g., `flake8-max-line-length` or `flake8-ignore`) should be placed in your `setup.cfg` under the `[tool:pytest]` section or in `pyproject.toml` under `[tool.pytest.ini_options]` if using pytest >= 6.0."},"warnings":[{"fix":"Consult pytest-flake8's release history and pytest's changelog for compatible versions, or upgrade to the latest versions of both for Python 3.9+.","message":"pytest-flake8 has experienced breaking changes with various pytest versions. Specifically, changes in pytest 3.5.0 (JUnit XML output) and pytest 4.1.0 (deprecated functions) caused incompatibilities in older pytest-flake8 versions. Additionally, Python 2, 3.5, and 3.6 are no longer supported since pytest-flake8 v1.1.0.","severity":"breaking","affected_versions":"<1.1.0 for Python compatibility, specific older versions for pytest compatibility"},{"fix":"To force a re-evaluation of all files and clear the cache, run `pytest --cache-clear --flake8`.","message":"By default, pytest-flake8 caches clean results. This can lead to all flake8 tests appearing to 'skip' if no relevant files have changed, which might be confusing during development.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Configure additional flake8 plugins using standard flake8 configuration files (e.g., `.flake8`, a `[flake8]` section in `setup.cfg`, or `[tool.flake8]` in `pyproject.toml`).","message":"pytest-flake8 does not provide a direct mechanism to configure *other* flake8 plugins (e.g., flake8-bugbear, flake8-docstrings) through its own pytest configuration options.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For optimal performance, consider running flake8 checks as a separate step in your CI pipeline or development workflow, rather than integrated directly with pytest for coverage runs.","message":"Running pytest-flake8 concurrently with pytest-cov (for code coverage) can significantly increase test execution time.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure pytest-flake8 configuration is correctly nested under the appropriate pytest configuration section in your `setup.cfg` or `pyproject.toml`.","message":"pytest-flake8-specific options (e.g., `flake8-ignore`, `flake8-max-line-length`) are read from the `[tool:pytest]` section in `setup.cfg` or the `[pytest]` or `[tool.pytest.ini_options]` sections in `pyproject.toml`. Placing these options directly under a generic `[flake8]` section may not be honored by the plugin.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}