This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

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 setup.cfg 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/fschulze/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

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)]
Release History

Release History

1.0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pytest-flakes-1.0.1.tar.gz (6.1 kB) Copy SHA256 Checksum SHA256 Source Sep 17, 2015
pytest-flakes-1.0.1.zip (11.3 kB) Copy SHA256 Checksum SHA256 Source Sep 17, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting