Skip to content

Commit c8bbaeb

Browse files
author
Anis Da Silva Campos
committed
remove support of pylint v1
not needed anymore now that we require >=v2
1 parent f8064a3 commit c8bbaeb

File tree

5 files changed

+11
-24
lines changed

5 files changed

+11
-24
lines changed

pylint_pytest/checkers/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import pylint
21
from pylint.checkers import BaseChecker
32

3+
from pylint_pytest.utils import PYLINT_VERSION_MAJOR
4+
45

56
class BasePytestChecker(BaseChecker):
6-
if int(pylint.version.split(".")[0]) < 3:
7+
if PYLINT_VERSION_MAJOR < 3:
8+
# todo(maybe-remove): if we only support pylint>=3
79
# Since https://github.com/pylint-dev/pylint/pull/8404, pylint does not need this
810
# __implements__ pattern. keeping it for retro compatibility with pylint==2.x
911
from pylint.interfaces import IAstroidChecker # pylint: disable=import-outside-toplevel

pylint_pytest/checkers/fixture.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from typing import Set, Tuple
66

77
import astroid
8-
import pylint
98
import pytest
109
from pylint.checkers.variables import VariablesChecker
1110

@@ -312,10 +311,4 @@ def patch_add_message(
312311
):
313312
return
314313

315-
if int(pylint.__version__.split(".")[0]) >= 2:
316-
FixtureChecker._original_add_message(
317-
self, msgid, line, node, args, confidence, col_offset
318-
)
319-
else:
320-
# python2 + pylint1.9 backward compatibility
321-
FixtureChecker._original_add_message(self, msgid, line, node, args, confidence)
314+
FixtureChecker._original_add_message(self, msgid, line, node, args, confidence, col_offset)

pylint_pytest/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import inspect
22

33
import astroid
4+
import pylint
5+
6+
PYLINT_VERSION_MAJOR = int(pylint.__version__.split(".")[0])
47

58

69
def _is_pytest_mark_usefixtures(decorator):

tests/base_tester.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@
66
from typing import Any, Dict, List
77

88
import astroid
9-
from pylint.testutils import MessageTest, UnittestLinter
10-
11-
try:
12-
from pylint.utils import ASTWalker
13-
except ImportError:
14-
# for pylint 1.9
15-
from pylint.utils import PyLintASTWalker as ASTWalker
16-
179
from pylint.checkers import BaseChecker
10+
from pylint.testutils import MessageTest, UnittestLinter
11+
from pylint.utils import ASTWalker
1812

1913
import pylint_pytest.checkers.fixture
2014

tests/test_regression.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pylint
21
import pytest
32
from base_tester import BasePytestTester
43
from pylint.checkers.variables import VariablesChecker
@@ -18,9 +17,5 @@ def test_import_twice(self, enable_plugin):
1817
"""catch a coding error when using fixture + if + inline import"""
1918
self.run_linter(enable_plugin)
2019

21-
if int(pylint.__version__.split(".")[0]) < 2:
22-
# for some reason pylint 1.9.5 does not raise unused-import for inline import
23-
self.verify_messages(1, msg_id="unused-import")
24-
else:
25-
self.verify_messages(2, msg_id="unused-import")
20+
self.verify_messages(2, msg_id="unused-import")
2621
self.verify_messages(1, msg_id="redefined-outer-name")

0 commit comments

Comments
 (0)