Skip to content

mark/structure: fix pylint complaining that builtin marks are not callable#7476

Merged
nicoddemus merged 1 commit into
pytest-dev:masterfrom
bluetech:pylint-callable
Jul 10, 2020
Merged

mark/structure: fix pylint complaining that builtin marks are not callable#7476
nicoddemus merged 1 commit into
pytest-dev:masterfrom
bluetech:pylint-callable

Conversation

@bluetech
Copy link
Copy Markdown
Member

This fixes #7473.

It seems that pylint doesn't understand TYPE_CHECKING and/or the type comments, and thinks parametrize and friends are None, and then complains that they are not callable.

The solution is a little uglier but seems to do the trick. On Python 3.6 we can use the nice syntax, which I also tested and will work.

parametrize = None # type: _ParametrizeMarkDecorator
usefixtures = None # type: _UsefixturesMarkDecorator
filterwarnings = None # type: _FilterwarningsMarkDecorator
skip = cast(_SkipMarkDecorator, None)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps leave a TODO note to use proper type annotations once we drop Python 3.5?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had it in my unsaved editor buffer 🤦 Pushed now.

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 this pull request may close these issues.

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

2 participants