Registry / testing / pytest-pep8

pytest-pep8

JSON →
library1.0.6pypypiunverified

pytest-pep8 is a pytest plugin designed to check PEP8 compliance in Python code. It integrates directly with the pytest testing framework to efficiently discover and check `.py` files for style guide violations. The plugin allows for flexible configuration to ignore specific errors or warnings on a per-project or per-file basis. Its last release was in April 2014, and it is largely unmaintained now.

pip install pytest-pep8
INSTALL
IMPORT
SIG · PYTEST-PEP8
P
pytest-pep8
testingpythonv1.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Install the plugin via pip, then run pytest with the `--pep8` flag. The plugin will automatically discover and check Python files for PEP8 violations. Configuration for ignoring specific errors can be done in `pytest.ini` or `setup.cfg`.

# content of myproject/myfile.py def somefunc( arg1, arg2): pass # Terminal # Install the plugin # pip install pytest-pep8 # Run pytest with the --pep8 flag # pytest --pep8
Debug
Known issues
breakingThe `pytest-pep8` plugin is incompatible with `pytest` versions 6.0.1 and newer due to significant internal API changes within pytest, specifically regarding node construction.
fix
This project is unmaintained. Migrate to actively maintained alternatives like `pytest-flake8` or `pytest-pycodestyle`. Downgrading `pytest` is not recommended.
affects: pytest >= 6.0.1
deprecatedThe `pytest-pep8` project is largely unmaintained since its last release in April 2014. The underlying 'pep8' library it relies on has also been renamed to `pycodestyle`.
fix
Users are strongly advised to migrate to actively maintained PEP8/Flake8 checking plugins for pytest, such as `pytest-flake8` or `pytest-pycodestyle`, for better compatibility and continued support.
affects: All versions
gotchaRunning `pytest --pep8` on an existing codebase may initially report a large number of PEP8 violations, potentially overwhelming.
fix
It is recommended to configure `pep8ignore = * ALL` in your `pytest.ini` or `setup.cfg` to initially ignore all errors, then gradually re-enable specific checks or add specific ignore codes as you clean up your code. You can also configure `pep8maxlinelength` for custom line limits.
affects: All versions
gotchaThe plugin uses caching to improve performance, which can sometimes lead to stale results where changes in files are not immediately reflected in subsequent PEP8 checks.
fix
To force a full re-check and clear the plugin's cache, run pytest with both the `--pep8` and `--clearcache` options: `pytest --pep8 --clearcache`.
affects: All versions
Errors
Common errors & fixes
PytestDeprecationWarning: Direct construction of Pep8Item has been deprecated, please use Pep8Item.from_parent.
This error occurs because `pytest-pep8` uses an older internal API for constructing test items that has been deprecated and removed in recent versions of `pytest` (>= 6.0.1).
fix
The `pytest-pep8` plugin is abandoned. You should migrate to a modern, actively maintained linter plugin such as `pytest-flake8` or `pytest-pycodestyle`.
Running `pytest --pep8` reports an overwhelming number of PEP8 errors on my existing Python project.
Most older or unlinted Python projects will have numerous violations of the PEP8 style guide, and `pytest-pep8` checks all discovered `.py` files by default.
fix
Start by adding `pep8ignore = * ALL` under the `[pytest]` section in your `pytest.ini` or `setup.cfg` file to ignore all errors. Then, gradually remove `ALL` or specify individual error codes to ignore (e.g., `pep8ignore = E201 E231`) as you refactor your code.
PEP8 checks are not updating or re-running after I modify and save a Python file.
The `pytest-pep8` plugin implements caching to speed up repeated runs. This cache might prevent checks from re-running on files it believes haven't changed.
fix
To explicitly clear the cache and force `pytest-pep8` to re-evaluate all files, run `pytest` with the `--pep8` and `--clearcache` command-line options: `pytest --pep8 --clearcache`.
Upgrade
Version history
1.0.6latest on PyPI · released Apr 27, 2014
Audit
Dependencies
pytestrequiredCore testing framework required for plugin functionality.
pytest-cacherequiredUsed by pytest-pep8 for caching results.
pycodestylerequiredThe underlying style checker (formerly 'pep8' library) is implicitly required for functionality.
Agent activity
4 hits · last 30 days
node
4
Resources
pytest-pep8 — pip install pytest-pep8 · libregistry