Skip to content

pytest 6: pylint shows not-callable error for builtin pytest marks #7473

Closed
@The-Compiler

Description

@The-Compiler

With the current versions of pylint (2.5.3) and the underlying astroid (2.4.2), running pylint against a simple pytest 6.0.0rc1 test:

import pytest

@pytest.mark.parametrize('a', [1, 2])
def test_a(a):
    pass

results in:

************* Module test_pylint
test_pylint.py:3:1: E1102: pytest.mark.parametrize is not callable (not-callable)

which isn't the case with pytest 5.4.3. I was able to bisect this to b3fb5a2 (#7379, "Type annotate pytest.mark.* builtin marks" by @bluetech).

Note that to my knowledge, pylint doesn't know about type annotations and relies on its inference only. Thus, I suppose it either only sees parametrize = None, or it sees _ParametrizeMarkDecorator.__call__ raising NotImplementedError. Not sure what, though. Maybe @PCManticore can explain what exactly is going on there?

Not sure how to best make this work in a way that pylint understands it (or, alternatively, fix it in pylint?) though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions