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.
pip install pytest-flake8No compatibility data collected yet for this library.
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.
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+.
To force a re-evaluation of all files and clear the cache, run `pytest --cache-clear --flake8`.
Configure additional flake8 plugins using standard flake8 configuration files (e.g., `.flake8`, a `[flake8]` section in `setup.cfg`, or `[tool.flake8]` in `pyproject.toml`).
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.
Ensure pytest-flake8 configuration is correctly nested under the appropriate pytest configuration section in your `setup.cfg` or `pyproject.toml`.
Install the plugin using `pip install pytest-flake8` in your active Python environment.
Install the missing dependency by running `pip install flake8`.
Configure flake8 options in your `pytest.ini` or `pyproject.toml` file under the `[flake8]` section, for example: `[flake8] ignore = E501, W292 max-line-length = 100`.
Upgrade your Python environment to version 3.9 or newer, or use an older version of pytest-flake8 that supports your current Python version.