diff --git a/src/_pytest/_code/source.py b/src/_pytest/_code/source.py index 1e9dd5031..a26a70e68 100644 --- a/src/_pytest/_code/source.py +++ b/src/_pytest/_code/source.py @@ -60,7 +60,7 @@ class Source: raise NotImplementedError() @overload # noqa: F811 - def __getitem__(self, key: slice) -> "Source": + def __getitem__(self, key: slice) -> "Source": # noqa: F811 raise NotImplementedError() def __getitem__(self, key: Union[int, slice]) -> Union[str, "Source"]: # noqa: F811 diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index af4d00194..2f9ca6de0 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -1074,13 +1074,14 @@ def try_makedirs(cache_dir) -> bool: def get_cache_dir(file_path: Path) -> Path: """Returns the cache directory to write .pyc files for the given .py file path""" - if sys.version_info >= (3, 8) and sys.pycache_prefix: + # Type ignored until added in next mypy release. + if sys.version_info >= (3, 8) and sys.pycache_prefix: # type: ignore # given: # prefix = '/tmp/pycs' # path = '/home/user/proj/test_app.py' # we want: # '/tmp/pycs/home/user/proj' - return Path(sys.pycache_prefix) / Path(*file_path.parts[1:-1]) + return Path(sys.pycache_prefix) / Path(*file_path.parts[1:-1]) # type: ignore else: # classic pycache directory return file_path.parent / "__pycache__" diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 5e066c18e..c115ae98d 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -40,7 +40,8 @@ MODULE_NOT_FOUND_ERROR = ( if sys.version_info >= (3, 8): - from importlib import metadata as importlib_metadata # noqa: F401 + # Type ignored until next mypy release. + from importlib import metadata as importlib_metadata # type: ignore else: import importlib_metadata # noqa: F401 @@ -407,7 +408,9 @@ else: raise NotImplementedError() @overload # noqa: F811 - def __get__(self, instance: _S, owner: Optional["Type[_S]"] = ...) -> _T: + def __get__( # noqa: F811 + self, instance: _S, owner: Optional["Type[_S]"] = ... + ) -> _T: raise NotImplementedError() def __get__(self, instance, owner=None): # noqa: F811 diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 52a91a905..9f206ce9b 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -552,7 +552,7 @@ def raises( @overload # noqa: F811 -def raises( +def raises( # noqa: F811 expected_exception: Union["Type[_E]", Tuple["Type[_E]", ...]], func: Callable, *args: Any, diff --git a/src/_pytest/recwarn.py b/src/_pytest/recwarn.py index 4967106d9..5cf32c894 100644 --- a/src/_pytest/recwarn.py +++ b/src/_pytest/recwarn.py @@ -60,18 +60,18 @@ def warns( *, match: "Optional[Union[str, Pattern]]" = ... ) -> "WarningsChecker": - ... # pragma: no cover + raise NotImplementedError() @overload # noqa: F811 -def warns( +def warns( # noqa: F811 expected_warning: Union["Type[Warning]", Tuple["Type[Warning]", ...]], func: Callable, *args: Any, match: Optional[Union[str, "Pattern"]] = ..., **kwargs: Any ) -> Union[Any]: - ... # pragma: no cover + raise NotImplementedError() def warns( # noqa: F811