pytest-flakes
=============
py.test plugin for efficiently checking python source with pyflakes.
Usage
-----
install via::
pip install pytest-flakes
if you then type::
py.test --flakes
every file ending in ``.py`` will be discovered and run through pyflakes,
starting from the command line arguments.
Simple usage example
-----------------------------
Consider you have this code::
# content of module.py
import os
from os.path import *
def some_function():
pass
Running it with pytest-flakes installed shows two issues::
$ py.test -q --flakes
F
================================= FAILURES =================================
______________________________ pyflakes-check ______________________________
/tmp/doc-exec-685/module.py:2: UnusedImport
'os' imported but unused
/tmp/doc-exec-685/module.py:3: ImportStarUsed
'from os.path import *' used; unable to detect undefined names
1 failed in 0.00 seconds
These are only two of the many issues that pytest-flakes can find.
Configuring pyflakes options per project and file
-------------------------------------------------
You may configure pyflakes-checking options for your project
by adding an ``flakes-ignore`` entry to your ``setup.cfg``
or ``pytest.ini`` file like this::
# content of setup.cfg
[pytest]
flakes-ignore = ImportStarUsed
This would globally prevent complaints about star imports.
Rerunning with the above example will now look better::
$ py.test -q --flakes
F
================================= FAILURES =================================
_________________ pyflakes-check(ignoring ImportStarUsed) __________________
/tmp/doc-exec-685/module.py:2: UnusedImport
'os' imported but unused
1 failed in 0.00 seconds
But of course we still would want to delete the ``import os`` line to
have a clean pass.
If you have some files where you want to specifically ignore
some errors or warnings you can start a flakes-ignore line with
a glob-pattern and a space-separated list of codes::
# content of setup.cfg
[pytest]
flakes-ignore =
*.py UnusedImport
doc/conf.py ALL
Ignoring certain lines in files
-------------------------------
You can ignore errors per line by appending special comments to them like this::
import sys # noqa
app # pragma: no flakes
Running pyflakes checks and no other tests
------------------------------------------
You can restrict your test run to only perform "flakes" tests
and not any other tests by typing::
py.test --flakes -m flakes
This will only run tests that are marked with the "flakes" keyword
which is added for the flakes test items added by this plugin.
If you are using pytest < 2.4, then use the following invocation
to the same effect::
py.test --flakes -k flakes
Notes
-----
The repository of this plugin is at https://github.com/asmeurer/pytest-flakes
For more info on py.test see http://pytest.org
The code is partially based on Ronny Pfannschmidt's pytest-codecheckers plugin
and Holger Krekel's pytest-pep8.
Changes
=======
4.0.5 - 2021-12-02
------------------
- Further fixes for deprecations in the upcoming pytest 7.0. [nicoddemus]
4.0.4 - 2021-10-26
------------------
- Fix pytest-flakes for deprecations in the upcoming pytest 7.0. [bluetech]
- Fix the pytest-flakes test suite in Python 3.10. [bluetech]
- Replace Travis CI with GitHub Actions. [bluetech]
4.0.3 - 2020-11-27
------------------
- Future proof some code against future versions of pytest. [RonnyPfannschmidt]
4.0.2 - 2020-09-18
------------------
- Fix calling pytest --flakes directly on an __init__.py file. [akeeman]
4.0.1 - 2020-07-28
------------------
- Maintenance of pytest-flakes has moved from fschulze to asmeurer. The repo
for pytest-flakes is now at https://github.com/asmeurer/pytest-flakes/
- Fix test failures.
[asmeurer]
- Fix deprecation warnings from pytest.
[asmeurer]
- Fix invalid escape sequences.
[akeeman]
4.0.0 - 2018-08-01
------------------
- Require pytest >= 2.8.0 and remove pytest-cache requirement.
Cache is included in pytest since that version.
[smarlowucf (Sean Marlow)]
3.0.2 - 2018-05-16
------------------
- Fix typo in name of ``flakes`` marker.
[fschulze]
3.0.1 - 2018-05-16
------------------
- Always register ``flakes`` marker, not only when the ``--flakes`` option
is used.
[fschulze]
3.0.0 - 2018-05-16
------------------
- Drop support for Python 3.3. It still works so far, but isn't tested anymore.
[fschulze]
- Add ``flakes`` marker required since pytest 3.1.
[fschulze]
- Use pyflakes.api.isPythonFile to detect Python files. This might test more
files than before and thus could cause previously uncaught failures.
[asmeurer (Aaron Meurer)]
2.0.0 - 2017-05-12
------------------
- Dropped support/testing for Python 2.5, 2.6, 3.2.
[fschulze]
- Added testing for Python 3.6.
[fschulze]
- Fixed some packaging and metadata errors.
[fladi (Michael Fladischer), fschulze]
1.0.1 - 2015-09-17
------------------
- Compatibility with upcoming pytest.
[RonnyPfannschmidt (Ronny Pfannschmidt)]
1.0.0 - 2015-05-01
------------------
- Fix issue #6 - support PEP263 for source file encoding.
[The-Compiler (Florian Bruhin), fschulze]
- Clarified license to be MIT like pytest-pep8 from which this is derived.
[fschulze]
0.2 - 2013-02-11
----------------
- Adapt to pytest-2.4.2 using ``add_marker()`` API.
[fschulze, hpk42 (Holger Krekel)]
- Allow errors to be skipped per line by appending # noqa or # pragma: no flakes
[fschulze, silviot (Silvio Tomatis)]
- Python 3.x compatibility.
[fschulze, encukou (Petr Viktorin)]
0.1 - 2013-02-04
----------------
- Initial release.
[fschulze (Florian Schulze)]
Raw data
{
"_id": null,
"home_page": "https://github.com/asmeurer/pytest-flakes",
"name": "pytest-flakes",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "",
"author": "Florian Schulze, Holger Krekel and Ronny Pfannschmidt",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/b5/8c/7d4bb3475c373b16ece7a94bd0e33ec045076c9189ed4022299679885179/pytest-flakes-4.0.5.tar.gz",
"platform": "",
"description": "pytest-flakes\n=============\n\npy.test plugin for efficiently checking python source with pyflakes.\n\n\nUsage\n-----\n\ninstall via::\n\n pip install pytest-flakes\n\nif you then type::\n\n py.test --flakes\n\nevery file ending in ``.py`` will be discovered and run through pyflakes,\nstarting from the command line arguments.\n\nSimple usage example\n-----------------------------\n\nConsider you have this code::\n\n # content of module.py\n\n import os\n from os.path import *\n\n def some_function():\n pass\n\nRunning it with pytest-flakes installed shows two issues::\n\n $ py.test -q --flakes\n F\n ================================= FAILURES =================================\n ______________________________ pyflakes-check ______________________________\n /tmp/doc-exec-685/module.py:2: UnusedImport\n 'os' imported but unused\n /tmp/doc-exec-685/module.py:3: ImportStarUsed\n 'from os.path import *' used; unable to detect undefined names\n 1 failed in 0.00 seconds\n\nThese are only two of the many issues that pytest-flakes can find.\n\nConfiguring pyflakes options per project and file\n-------------------------------------------------\n\nYou may configure pyflakes-checking options for your project\nby adding an ``flakes-ignore`` entry to your ``setup.cfg``\nor ``pytest.ini`` file like this::\n\n # content of setup.cfg\n [pytest]\n flakes-ignore = ImportStarUsed\n\nThis would globally prevent complaints about star imports.\nRerunning with the above example will now look better::\n\n $ py.test -q --flakes\n F\n ================================= FAILURES =================================\n _________________ pyflakes-check(ignoring ImportStarUsed) __________________\n /tmp/doc-exec-685/module.py:2: UnusedImport\n 'os' imported but unused\n 1 failed in 0.00 seconds\n\nBut of course we still would want to delete the ``import os`` line to\nhave a clean pass.\n\nIf you have some files where you want to specifically ignore\nsome errors or warnings you can start a flakes-ignore line with\na glob-pattern and a space-separated list of codes::\n\n # content of setup.cfg\n [pytest]\n flakes-ignore =\n *.py UnusedImport\n doc/conf.py ALL\n\n\nIgnoring certain lines in files\n-------------------------------\n\nYou can ignore errors per line by appending special comments to them like this::\n\n import sys # noqa\n app # pragma: no flakes\n\n\nRunning pyflakes checks and no other tests\n------------------------------------------\n\nYou can restrict your test run to only perform \"flakes\" tests\nand not any other tests by typing::\n\n py.test --flakes -m flakes\n\nThis will only run tests that are marked with the \"flakes\" keyword\nwhich is added for the flakes test items added by this plugin.\n\nIf you are using pytest < 2.4, then use the following invocation\nto the same effect::\n\n py.test --flakes -k flakes\n\n\nNotes\n-----\n\nThe repository of this plugin is at https://github.com/asmeurer/pytest-flakes\n\nFor more info on py.test see http://pytest.org\n\nThe code is partially based on Ronny Pfannschmidt's pytest-codecheckers plugin\nand Holger Krekel's pytest-pep8.\n\n\nChanges\n=======\n\n4.0.5 - 2021-12-02\n------------------\n- Further fixes for deprecations in the upcoming pytest 7.0. [nicoddemus]\n\n4.0.4 - 2021-10-26\n------------------\n- Fix pytest-flakes for deprecations in the upcoming pytest 7.0. [bluetech]\n- Fix the pytest-flakes test suite in Python 3.10. [bluetech]\n- Replace Travis CI with GitHub Actions. [bluetech]\n\n4.0.3 - 2020-11-27\n------------------\n\n- Future proof some code against future versions of pytest. [RonnyPfannschmidt]\n\n4.0.2 - 2020-09-18\n------------------\n\n- Fix calling pytest --flakes directly on an __init__.py file. [akeeman]\n\n4.0.1 - 2020-07-28\n------------------\n\n- Maintenance of pytest-flakes has moved from fschulze to asmeurer. The repo\n for pytest-flakes is now at https://github.com/asmeurer/pytest-flakes/\n\n- Fix test failures.\n [asmeurer]\n\n- Fix deprecation warnings from pytest.\n [asmeurer]\n\n- Fix invalid escape sequences.\n [akeeman]\n\n4.0.0 - 2018-08-01\n------------------\n\n- Require pytest >= 2.8.0 and remove pytest-cache requirement.\n Cache is included in pytest since that version.\n [smarlowucf (Sean Marlow)]\n\n\n3.0.2 - 2018-05-16\n------------------\n\n- Fix typo in name of ``flakes`` marker.\n [fschulze]\n\n\n3.0.1 - 2018-05-16\n------------------\n\n- Always register ``flakes`` marker, not only when the ``--flakes`` option\n is used.\n [fschulze]\n\n\n3.0.0 - 2018-05-16\n------------------\n\n- Drop support for Python 3.3. It still works so far, but isn't tested anymore.\n [fschulze]\n\n- Add ``flakes`` marker required since pytest 3.1.\n [fschulze]\n\n- Use pyflakes.api.isPythonFile to detect Python files. This might test more\n files than before and thus could cause previously uncaught failures.\n [asmeurer (Aaron Meurer)]\n\n\n2.0.0 - 2017-05-12\n------------------\n\n- Dropped support/testing for Python 2.5, 2.6, 3.2.\n [fschulze]\n\n- Added testing for Python 3.6.\n [fschulze]\n\n- Fixed some packaging and metadata errors.\n [fladi (Michael Fladischer), fschulze]\n\n\n1.0.1 - 2015-09-17\n------------------\n\n- Compatibility with upcoming pytest.\n [RonnyPfannschmidt (Ronny Pfannschmidt)]\n\n\n1.0.0 - 2015-05-01\n------------------\n\n- Fix issue #6 - support PEP263 for source file encoding.\n [The-Compiler (Florian Bruhin), fschulze]\n\n- Clarified license to be MIT like pytest-pep8 from which this is derived.\n [fschulze]\n\n\n0.2 - 2013-02-11\n----------------\n\n- Adapt to pytest-2.4.2 using ``add_marker()`` API.\n [fschulze, hpk42 (Holger Krekel)]\n\n- Allow errors to be skipped per line by appending # noqa or # pragma: no flakes\n [fschulze, silviot (Silvio Tomatis)]\n\n- Python 3.x compatibility.\n [fschulze, encukou (Petr Viktorin)]\n\n\n0.1 - 2013-02-04\n----------------\n\n- Initial release.\n [fschulze (Florian Schulze)]\n\n\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "pytest plugin to check source code with pyflakes",
"version": "4.0.5",
"project_urls": {
"Homepage": "https://github.com/asmeurer/pytest-flakes"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b5f83e4f988403081d526c4fa5d0256f84ac03a60744e4f9d839526ab8cb7bef",
"md5": "ca9876a9302b2218e2f660ac3659fb17",
"sha256": "d0e8602d882744fc6169247b62a51203c5a3d8f160892ff3b82f5b9c1e4bb675"
},
"downloads": -1,
"filename": "pytest_flakes-4.0.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "ca9876a9302b2218e2f660ac3659fb17",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.5",
"size": 6830,
"upload_time": "2021-12-02T22:09:21",
"upload_time_iso_8601": "2021-12-02T22:09:21.809092Z",
"url": "https://files.pythonhosted.org/packages/b5/f8/3e4f988403081d526c4fa5d0256f84ac03a60744e4f9d839526ab8cb7bef/pytest_flakes-4.0.5-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b58c7d4bb3475c373b16ece7a94bd0e33ec045076c9189ed4022299679885179",
"md5": "e962bc0731dd062e9354f6bd65968150",
"sha256": "953134e97215ae31f6879fbd7368c18d43f709dc2fab5b7777db2bb2bac3a924"
},
"downloads": -1,
"filename": "pytest-flakes-4.0.5.tar.gz",
"has_sig": false,
"md5_digest": "e962bc0731dd062e9354f6bd65968150",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 7313,
"upload_time": "2021-12-02T22:09:24",
"upload_time_iso_8601": "2021-12-02T22:09:24.477468Z",
"url": "https://files.pythonhosted.org/packages/b5/8c/7d4bb3475c373b16ece7a94bd0e33ec045076c9189ed4022299679885179/pytest-flakes-4.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-12-02 22:09:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "asmeurer",
"github_project": "pytest-flakes",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "pytest-flakes"
}