Skip to content

Commit d46fe88

Browse files
authored
Merge pull request #7566 from bluetech/pylint-callable-2-6.0.x
[6.0.x] mark: fix pylint not-callable error on pytest.mark.parametrize(...), again
2 parents 5d606e9 + bec1bda commit d46fe88

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

changelog/7558.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks:
2+
``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``.

src/_pytest/mark/structures.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import warnings
55
from typing import Any
66
from typing import Callable
7-
from typing import cast
87
from typing import Iterable
98
from typing import List
109
from typing import Mapping
@@ -473,14 +472,13 @@ def test_function():
473472

474473
# See TYPE_CHECKING above.
475474
if TYPE_CHECKING:
476-
# Using casts instead of type comments intentionally - issue #7473.
477475
# TODO(py36): Change to builtin annotation syntax.
478-
skip = cast(_SkipMarkDecorator, None)
479-
skipif = cast(_SkipifMarkDecorator, None)
480-
xfail = cast(_XfailMarkDecorator, None)
481-
parametrize = cast(_ParametrizeMarkDecorator, None)
482-
usefixtures = cast(_UsefixturesMarkDecorator, None)
483-
filterwarnings = cast(_FilterwarningsMarkDecorator, None)
476+
skip = _SkipMarkDecorator(Mark("skip", (), {}))
477+
skipif = _SkipifMarkDecorator(Mark("skipif", (), {}))
478+
xfail = _XfailMarkDecorator(Mark("xfail", (), {}))
479+
parametrize = _ParametrizeMarkDecorator(Mark("parametrize", (), {}))
480+
usefixtures = _UsefixturesMarkDecorator(Mark("usefixtures", (), {}))
481+
filterwarnings = _FilterwarningsMarkDecorator(Mark("filterwarnings", (), {}))
484482

485483
def __getattr__(self, name: str) -> MarkDecorator:
486484
if name[0] == "_":

0 commit comments

Comments
 (0)