Skip to content

A Pylint plugin to suppress pytest-related false positives.

License

Notifications You must be signed in to change notification settings

gcapu/pylint-pytest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pylint-pytest

PyPI version fury.io Travis CI

A Pylint plugin to suppress pytest-related false positives.

Installation

Requirements:

  • pylint
  • pytest>=4.6

To install:

$ pip install pylint-pytest

Usage

Enable via command line option --load-plugins

$ pylint --load-plugins pylint_pytest <path_to_your_sources>

Or in pylintrc:

[MASTER]
load-plugins=pylint_pytest

Suppressed Pylint Warnings

unused-argument

FP when a fixture is used in an applicable function but not referenced in the function body, e.g.

def test_something(conftest_fixture):  # <- Unused argument 'conftest_fixture'
    assert True

unused-import

FP when an imported fixture is used in an applicable function, e.g.

from fixture_collections import imported_fixture  # <- Unused imported_fixture imported from fixture_collections

def test_something(imported_fixture):
    ...

redefined-outer-name

FP when an imported/declared fixture is used in an applicable function, e.g.

from fixture_collections import imported_fixture

def test_something(imported_fixture):  # <- Redefining name 'imported_fixture' from outer scope (line 1)
    ...

no-member

FP when class attributes are defined in setup fixtures

import pytest

class TestClass(object):
    @staticmethod
    @pytest.fixture(scope='class', autouse=True)
    def setup_class(request):
        cls = request.cls
        cls.defined_in_setup_class = True

    def test_foo(self):
        assert self.defined_in_setup_class  # <- Instance of 'TestClass' has no 'defined_in_setup_class' member

Changelog

See CHANGELOG.

License

pylint-pytest is available under MIT license.

About

A Pylint plugin to suppress pytest-related false positives.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages