From 08284a5f40025f4abee195a0054365aabad81a65 Mon Sep 17 00:00:00 2001 From: William Manley Date: Tue, 8 Sep 2020 14:38:33 +0100 Subject: [PATCH] Disable irrelevant pylint errors Errors were: ``` ************* Module stbt_rig stbt_rig.py:1237:4: [W0223(abstract-method), StbtCollector] Method 'get_closest_marker' is abstract in class 'Node' but is not overridden stbt_rig.py:1237:4: [W0223(abstract-method), StbtCollector] Method 'gethookproxy' is abstract in class 'FSCollector' but is not overridden stbt_rig.py:1237:4: [W0223(abstract-method), StbtCollector] Method 'isinitpath' is abstract in class 'FSCollector' but is not overridden stbt_rig.py:1257:4: [W0223(abstract-method), StbtRemoteTest] Method 'get_closest_marker' is abstract in class 'Node' but is not overridden ``` The `get_closest_marker` is a pylint false positive because it's defined multiple times in `class Node`: ```python class Node(metaclass=NodeMeta): ... @overload def get_closest_marker(self, name: str) -> Optional[Mark]: raise NotImplementedError() @overload # noqa: F811 def get_closest_marker(self, name: str, default: Mark) -> Mark: # noqa: F811 raise NotImplementedError() def get_closest_marker( # noqa: F811 self, name: str, default: Optional[Mark] = None ) -> Optional[Mark]: """return the first marker matching the name, from closest (for example function) to farther level (for example module level). :param default: fallback return value of no marker was found :param name: name to filter by """ return next(self.iter_markers(name=name), default) ``` The other two don't need to be inherited because they'll never be called: https://github.com/pytest-dev/pytest/issues/7591 . This is fixed in pytest 6.1: https://github.com/pytest-dev/pytest/pull/7648 --- stbt_rig.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stbt_rig.py b/stbt_rig.py index 2f8144b..131d668 100755 --- a/stbt_rig.py +++ b/stbt_rig.py @@ -1235,6 +1235,7 @@ def pytest_collect_file(path, parent): class StbtCollector(pytest.File): + # pylint: disable=abstract-method def collect(self): with open(self.fspath.strpath) as f: # We implement our own parsing to avoid import stbt ImportErrors @@ -1255,6 +1256,7 @@ def collect(self): class StbtRemoteTest(pytest.Item): + # pylint: disable=abstract-method def __init__(self, parent, filename, testname, line_number): super(StbtRemoteTest, self).__init__(testname, parent) self._filename = filename