{"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":"python","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,"search_vec":"'1.3.0':31 '3.9':46 'activ':34 'check':19 'code':21,50 'coher':38 'coherent-oss':37 'complex':27 'flake8':3,6,13,48 'integr':12 'linter':49 'maintain':35 'mccabe':26 'oss':39 'pep8':23 'plugin':10,53 'pyflak':24 'pytest':2,5,9,47 'pytest-flake8':1,4 'python':20,45 'qualiti':51 'regular':41 'releas':42 'suit':17 'support':44 'test':16,52 'version':30","created_at":"2026-04-14T01:33:23.544866+00:00","updated_at":"2026-04-16T20:01:54.131337+00:00","problems":[{"fix":"Install the plugin using `pip install pytest-flake8` in your active Python environment.","cause":"The pytest-flake8 plugin is not installed or not active in the Python environment where pytest is being executed.","error":"pytest: error: unrecognized arguments: --flake8"},{"fix":"Install the missing dependency by running `pip install flake8`.","cause":"The 'flake8' package, a required dependency for pytest-flake8, is missing from the current Python environment.","error":"ERROR: pytest-flake8 requires flake8. Please install it with 'pip install flake8'."},{"fix":"Configure flake8 options in your `pytest.ini` or `pyproject.toml` file under the `[flake8]` section, for example: `[flake8]\nignore = E501, W292\nmax-line-length = 100`.","cause":"pytest-flake8 is reporting a standard flake8 violation (e.g., line length or specific error code), and you haven't configured flake8 to ignore it or adjust its limits.","error":"E501 line too long (88 > 79)"},{"fix":"Upgrade your Python environment to version 3.9 or newer, or use an older version of pytest-flake8 that supports your current Python version.","cause":"The installed Python version (X.Y.Z) is older than the minimum required version (3.9) for pytest-flake8 version 1.3.0.","error":"ERROR: Package 'pytest-flake8' requires a different Python: X.Y.Z is not in '>=3.9'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/coherent-oss/pytest-flake8","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pytest-flake8/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-13","next_check":"2026-07-12","install_tag":null}}