pytest plugin for efficiently checking PEP8 compliance
======================================================
.. image:: https://img.shields.io/pypi/v/pytest-flake8.svg
:target: https://pypi.python.org/pypi/pytest-flake8
.. image:: https://img.shields.io/pypi/pyversions/pytest-flake8.svg
:target: https://pypi.python.org/pypi/pytest-flake8
.. image:: https://img.shields.io/pypi/implementation/pytest-flake8.svg
:target: https://pypi.python.org/pypi/pytest-flake8
.. image:: https://img.shields.io/pypi/status/pytest-flake8.svg
:target: https://pypi.python.org/pypi/pytest-flake8
.. image:: https://travis-ci.org/tholo/pytest-flake8.svg?branch=master
:target: https://travis-ci.org/tholo/pytest-flake8
.. image:: https://img.shields.io/github/issues/tholo/pytest-flake8.svg
:target: https://github.com/tholo/pytest-flake8/issues
.. image:: https://img.shields.io/github/issues-pr/tholo/pytest-flake8.svg
:target: https://github.com/tholo/pytest-flake8/pulls
Usage
-----
Install by running the command::
pip install pytest-flake8
After installing it, when you run tests with the option::
pytest --flake8
every file ending in ``.py`` will be discovered and checked with
flake8.
.. note::
If optional flake8 plugins are installed, those will
be used automatically. No provisions have been made for
configuring these via `pytest`_.
.. warning::
Running flake8 tests on your project is likely to cause a number
of issues. The plugin allows one to configure on a per-project and
per-file basis which errors or warnings to ignore, see
flake8-ignore_.
.. _flake8-ignore:
Configuring FLAKE8 options per project and file
-----------------------------------------------
Maximum line length and maximum doc line length can be configured for the
whole project by adding a ``flake8-max-line-length`` option and
``flake8-max-doc-length`` to your ``setup.cfg`` or ``tox.ini`` file like
this::
# content of setup.cfg
[tool:pytest]
flake8-max-line-length = 99
flake8-max-doc-length = 74
Note that the default will be what naturally comes with `flake8`_
(which it turn gets its default from `pycodestyle`_).
You may configure flake8-checking options for your project
by adding an ``flake8-ignore`` entry to your ``setup.cfg``
or ``tox.ini`` file like this::
# content of setup.cfg
[tool:pytest]
flake8-ignore = E201 E231
This would globally prevent complaints about two whitespace issues.
Rerunning with the above example will now look better::
$ pytest -q --flake8
collecting ... collected 1 items
.
1 passed in 0.01 seconds
If you have some files where you want to specifically ignore
some errors or warnings you can start a flake8-ignore line with
a glob-pattern and a space-separated list of codes::
# content of setup.cfg
[tool:pytest]
flake8-ignore =
*.py E201
doc/conf.py ALL
So if you have a conf.py like this::
# content of doc/conf.py
func ( [1,2,3]) #this line lots PEP8 errors :)
then running again with the previous example will show a single
failure and it will ignore doc/conf.py altogether::
$ pytest --flake8 -v # verbose shows what is ignored
======================================= test session starts ========================================
platform darwin -- Python 2.7.6 -- py-1.4.26 -- pytest-2.7.0 -- /Users/tholo/Source/pytest/bin/python
cachedir: /Users/tholo/Source/pytest/src/verify/.cache
rootdir: /Users/tholo/Source/angular/src/verify, inifile: setup.cfg
plugins: flake8, cache
collected 1 items
myfile.py PASSED
========================================= 1 passed in 0.00 seconds =========================================
Note that doc/conf.py was not considered or imported.
FAQs
-----
All the flake8 tests are skipping!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is by design. Clean flake8 results are cached and, unless the file is modified, not tested again.
You can run with ``pytest --cache-clear --flake8`` to override this.
Notes
-----
The repository of this plugin is at https://github.com/tholo/pytest-flake8
For more info on `pytest`_ see http://pytest.org
The code is partially based on Ronny Pfannschmidt's `pytest-codecheckers`_ plugin.
.. _`pytest`: http://pytest.org
.. _`flake8`: https://pypi.python.org/pypi/flake8
.. _`pycodestyle`: https://pypi.python.org/pypi/pycodestyle
.. _`pytest-codecheckers`: https://pypi.python.org/pypi/pytest-codecheckers
Raw data
{
"_id": null,
"home_page": "https://github.com/tholo/pytest-flake8",
"name": "pytest-flake8",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Thorsten Lockert",
"author_email": "tholo@sigmasoft.com",
"download_url": "https://files.pythonhosted.org/packages/e0/5f/73ea3b05a5abae642442b1e2c70203a7f3afbb7f5749e90956b36958c078/pytest-flake8-1.1.1.tar.gz",
"platform": null,
"description": "pytest plugin for efficiently checking PEP8 compliance \n======================================================\n\n.. image:: https://img.shields.io/pypi/v/pytest-flake8.svg\n :target: https://pypi.python.org/pypi/pytest-flake8\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest-flake8.svg\n :target: https://pypi.python.org/pypi/pytest-flake8\n\n.. image:: https://img.shields.io/pypi/implementation/pytest-flake8.svg\n :target: https://pypi.python.org/pypi/pytest-flake8\n\n.. image:: https://img.shields.io/pypi/status/pytest-flake8.svg\n :target: https://pypi.python.org/pypi/pytest-flake8\n\n.. image:: https://travis-ci.org/tholo/pytest-flake8.svg?branch=master\n :target: https://travis-ci.org/tholo/pytest-flake8\n\n.. image:: https://img.shields.io/github/issues/tholo/pytest-flake8.svg\n :target: https://github.com/tholo/pytest-flake8/issues\n\n.. image:: https://img.shields.io/github/issues-pr/tholo/pytest-flake8.svg\n :target: https://github.com/tholo/pytest-flake8/pulls\n\nUsage\n-----\n\nInstall by running the command::\n\n pip install pytest-flake8\n\nAfter installing it, when you run tests with the option::\n\n pytest --flake8\n\nevery file ending in ``.py`` will be discovered and checked with\nflake8.\n\n.. note::\n\n If optional flake8 plugins are installed, those will\n be used automatically. No provisions have been made for\n configuring these via `pytest`_.\n\n.. warning::\n\n Running flake8 tests on your project is likely to cause a number \n of issues. The plugin allows one to configure on a per-project and\n per-file basis which errors or warnings to ignore, see\n flake8-ignore_.\n\n.. _flake8-ignore:\n\nConfiguring FLAKE8 options per project and file\n-----------------------------------------------\n\nMaximum line length and maximum doc line length can be configured for the\nwhole project by adding a ``flake8-max-line-length`` option and\n``flake8-max-doc-length`` to your ``setup.cfg`` or ``tox.ini`` file like\nthis::\n\n # content of setup.cfg\n [tool:pytest]\n flake8-max-line-length = 99\n flake8-max-doc-length = 74\n\nNote that the default will be what naturally comes with `flake8`_\n(which it turn gets its default from `pycodestyle`_).\n\nYou may configure flake8-checking options for your project\nby adding an ``flake8-ignore`` entry to your ``setup.cfg``\nor ``tox.ini`` file like this::\n\n # content of setup.cfg\n [tool:pytest]\n flake8-ignore = E201 E231\n\nThis would globally prevent complaints about two whitespace issues.\nRerunning with the above example will now look better::\n\n $ pytest -q --flake8\n collecting ... collected 1 items\n .\n 1 passed in 0.01 seconds\n\nIf you have some files where you want to specifically ignore \nsome errors or warnings you can start a flake8-ignore line with \na glob-pattern and a space-separated list of codes::\n\n # content of setup.cfg\n [tool:pytest]\n flake8-ignore = \n *.py E201\n doc/conf.py ALL\n\nSo if you have a conf.py like this::\n\n # content of doc/conf.py\n\n func ( [1,2,3]) #this line lots PEP8 errors :)\n\nthen running again with the previous example will show a single\nfailure and it will ignore doc/conf.py altogether::\n\n $ pytest --flake8 -v # verbose shows what is ignored\n ======================================= test session starts ========================================\n platform darwin -- Python 2.7.6 -- py-1.4.26 -- pytest-2.7.0 -- /Users/tholo/Source/pytest/bin/python\n cachedir: /Users/tholo/Source/pytest/src/verify/.cache\n rootdir: /Users/tholo/Source/angular/src/verify, inifile: setup.cfg\n plugins: flake8, cache\n collected 1 items\n\n myfile.py PASSED\n\n ========================================= 1 passed in 0.00 seconds =========================================\n\nNote that doc/conf.py was not considered or imported.\n\nFAQs\n-----\n\nAll the flake8 tests are skipping!\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis is by design. Clean flake8 results are cached and, unless the file is modified, not tested again.\n\nYou can run with ``pytest --cache-clear --flake8`` to override this.\n\nNotes\n-----\n\nThe repository of this plugin is at https://github.com/tholo/pytest-flake8\n\nFor more info on `pytest`_ see http://pytest.org\n\nThe code is partially based on Ronny Pfannschmidt's `pytest-codecheckers`_ plugin.\n\n.. _`pytest`: http://pytest.org\n.. _`flake8`: https://pypi.python.org/pypi/flake8\n.. _`pycodestyle`: https://pypi.python.org/pypi/pycodestyle\n.. _`pytest-codecheckers`: https://pypi.python.org/pypi/pytest-codecheckers\n\n\n",
"bugtrack_url": null,
"license": "BSD License",
"summary": "pytest plugin to check FLAKE8 requirements",
"version": "1.1.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "2055b94cac87e999dcc587dafc6ef178",
"sha256": "e0661a786f8cbf976c185f706fdaf5d6df0b1667c3bcff8e823ba263618627e7"
},
"downloads": -1,
"filename": "pytest_flake8-1.1.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "2055b94cac87e999dcc587dafc6ef178",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 6599,
"upload_time": "2022-03-18T22:14:47",
"upload_time_iso_8601": "2022-03-18T22:14:47.782397Z",
"url": "https://files.pythonhosted.org/packages/42/22/b9580f30c864699a90a0d699acc6e739087e298c45caa4f1bf740030a938/pytest_flake8-1.1.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "15f0042167c2cd75b4b32a82fc92eeae",
"sha256": "ba4f243de3cb4c2486ed9e70752c80dd4b636f7ccb27d4eba763c35ed0cd316e"
},
"downloads": -1,
"filename": "pytest-flake8-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "15f0042167c2cd75b4b32a82fc92eeae",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9144,
"upload_time": "2022-03-18T22:14:49",
"upload_time_iso_8601": "2022-03-18T22:14:49.625359Z",
"url": "https://files.pythonhosted.org/packages/e0/5f/73ea3b05a5abae642442b1e2c70203a7f3afbb7f5749e90956b36958c078/pytest-flake8-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-03-18 22:14:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "tholo",
"github_project": "pytest-flake8",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "pytest-flake8"
}