Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Pylint plugin to suppress pytest-related false positives.

License

NotificationsYou must be signed in to change notification settings

pylint-dev/pylint-pytest

 
 

Repository files navigation

PyPI - VersionPyPI - Python VersionPyPI - DownloadsPyPI - License

Github - Testingcodecov

pre-commit.ci statusCode style: blackChecked with mypyPylintRuff

Say Thanks!

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.

deftest_something(conftest_fixture):# <- Unused argument 'conftest_fixture'assertTrue

unused-import

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

fromfixture_collectionsimport (imported_fixture,)# <- Unused imported_fixture imported from fixture_collectionsdeftest_something(imported_fixture):    ...

redefined-outer-name

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

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

no-member

FP when class attributes are defined in setup fixtures

importpytestclassTestClass(object):@staticmethod@pytest.fixture(scope="class",autouse=True)defsetup_class(request):cls=request.clscls.defined_in_setup_class=Truedeftest_foo(self):assert (self.defined_in_setup_class        )# <- Instance of 'TestClass' has no 'defined_in_setup_class' member

Raise new warning(s)

W6401deprecated-pytest-yield-fixture

Raise when using deprecated@pytest.yield_fixture decorator (ref)

importpytest@pytest.yield_fixture# <- Using a deprecated @pytest.yield_fixture decoratordefyield_fixture():yield

W6402useless-pytest-mark-decorator

Raise when using every@pytest.mark.* for the fixture (ref)

importpytest@pytest.fixturedefawesome_fixture():    ...@pytest.fixture@pytest.mark.usefixtures("awesome_fixture")# <- Using useless `@pytest.mark.*` decorator for fixturesdefanother_awesome_fixture():    ...

W6403deprecated-positional-argument-for-pytest-fixture

Raise when using deprecated positional arguments for fixture decorator (ref)

importpytest@pytest.fixture("module")# <- Using a deprecated positional arguments for fixturedefawesome_fixture():    ...

F6401cannot-enumerate-pytest-fixtures

Raise when the plugin cannot enumerate and collect pytest fixtures for analysis

NOTE: this warning is only added to test modules (test_*.py /*_test.py)

importno_such_package# <- pylint-pytest plugin cannot enumerate and collect pytest fixtures

Changelog

SeeCHANGELOG.

License

pylint-pytest is available underMIT license.

About

A Pylint plugin to suppress pytest-related false positives.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python97.3%
  • Makefile2.7%

[8]ページ先頭

©2009-2025 Movatter.jp