Welcome to pytest-flake8 documentation!

py.test plugin to test with flake8.

exception pytest_flake8.Flake8Error

Bases: Exception

indicates an error during flake8 checks.

class pytest_flake8.Flake8File(*k, **kw)

Bases: File

collect()

Collect children (items and collectors) for this collector.

config: Config

The pytest config object.

name: str

A unique name within the scope of the parent node.

parent

The parent collector node.

path: pathlib.Path

Filesystem path where this node was collected from (can be None).

session: Session

The pytest session this node is part of.

class pytest_flake8.Flake8Item(*k, **kw)

Bases: Item

config: Config

The pytest config object.

name: str

A unique name within the scope of the parent node.

parent

The parent collector node.

path: pathlib.Path

Filesystem path where this node was collected from (can be None).

reportinfo()

Get location information for this item for test reports.

Returns a tuple with three elements:

  • The path of the test (default self.path)

  • The 0-based line number of the test (default None)

  • A name of the test to be shown (default "")

repr_failure(excinfo)

Return a representation of a collection or test failure.

Parameters:

excinfo – Exception information for the failure.

runtest()

Run the test case for this item.

Must be implemented by subclasses.

session: Session

The pytest session this node is part of.

setup()
class pytest_flake8.Ignorer(ignorelines, coderex=re.compile('[EW]\\d\\d\\d'))

Bases: object

pytest_flake8.check_file(path, flake8ignore, maxlength, maxdoclenght, maxcomplexity, showsource, statistics)

Run flake8 over a single file, and return the number of failures.

pytest_flake8.pytest_addoption(parser)

Hook up additional options.

pytest_flake8.pytest_collect_file(file_path, path, parent)

Filter files down to which ones should be checked.

pytest_flake8.pytest_configure(config)

Start a new session.

pytest_flake8.pytest_unconfigure(config)

Flush cache at end of run.

Indices and tables