Skip to content

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

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

Merged
merged 1 commit into from
Jul 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/_pytest/mark/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import warnings
from typing import Any
from typing import Callable
from typing import cast
from typing import Iterable
from typing import List
from typing import Mapping
Expand Down Expand Up @@ -467,12 +468,14 @@ def test_function():

# See TYPE_CHECKING above.
if TYPE_CHECKING:
skip = None # type: _SkipMarkDecorator
skipif = None # type: _SkipifMarkDecorator
xfail = None # type: _XfailMarkDecorator
parametrize = None # type: _ParametrizeMarkDecorator
usefixtures = None # type: _UsefixturesMarkDecorator
filterwarnings = None # type: _FilterwarningsMarkDecorator
# Using casts instead of type comments intentionally - issue #7473.
# TODO(py36): Change to builtin annotation syntax.
skip = cast(_SkipMarkDecorator, None)
Copy link
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
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.

skipif = cast(_SkipifMarkDecorator, None)
xfail = cast(_XfailMarkDecorator, None)
parametrize = cast(_ParametrizeMarkDecorator, None)
usefixtures = cast(_UsefixturesMarkDecorator, None)
filterwarnings = cast(_FilterwarningsMarkDecorator, None)

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