Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
The-Compiler opened this issue Jul 10, 2020 · 1 comment · Fixed by #7476
Closed

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

The-Compiler opened this issue Jul 10, 2020 · 1 comment · Fixed by #7476

Comments

@The-Compiler
Copy link
Member

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.

@bluetech
Copy link
Member

Thanks for testing @The-Compiler! I do think ideally this will be fixed in pylint but it's understandable that it gets confused by this, so I posted a fix in #7476.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants