This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
F6401
cannot-enumerate-pytest-fixtures
(#16)
- Loading branch information
Showing
6 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
tests/input/cannot-enumerate-pytest-fixtures/import_corrupted_module.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from no_such_package import fixture | ||
|
||
|
||
def test_something(fixture): | ||
pass |
10 changes: 10 additions & 0 deletions
10
tests/input/cannot-enumerate-pytest-fixtures/no_such_package.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import pytest | ||
import this_is_invalid # makes pytest fail | ||
|
||
|
||
@pytest.fixture | ||
def fixture(): | ||
pass | ||
|
||
def test_something(fixture): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
from pylint.checkers.variables import VariablesChecker | ||
from base_tester import BasePytestTester | ||
from pylint_pytest.checkers.fixture import FixtureChecker | ||
|
||
|
||
class TestCannotEnumerateFixtures(BasePytestTester): | ||
CHECKER_CLASS = FixtureChecker | ||
MSG_ID = 'cannot-enumerate-pytest-fixtures' | ||
|
||
@pytest.mark.parametrize('enable_plugin', [True, False]) | ||
def test_no_such_package(self, enable_plugin): | ||
self.run_linter(enable_plugin) | ||
self.verify_messages(1 if enable_plugin else 0) | ||
|
||
@pytest.mark.parametrize('enable_plugin', [True, False]) | ||
def test_import_corrupted_module(self, enable_plugin): | ||
self.run_linter(enable_plugin) | ||
self.verify_messages(1 if enable_plugin else 0) |
This check is buggy and should be fixed by #22.