Update mock to 5.1.* (#10472)

This commit is contained in:
Nikita Sobolev
2023-07-19 15:01:01 +03:00
committed by GitHub
parent 8da4739042
commit 9e7477d986
4 changed files with 42 additions and 2 deletions

View File

@@ -1,2 +1,6 @@
mock.patch
mock.mock.patch
# Uses `_timeout_unset` sentinel:
mock.mock.ThreadingMixin.__init__
mock.mock.ThreadingMixin.wait_until_called

View File

@@ -1 +1 @@
version = "5.0.*"
version = "5.1.*"

View File

@@ -1,3 +1,24 @@
from .mock import *
__all__ = (
"__version__",
"version_info",
"Mock",
"MagicMock",
"patch",
"sentinel",
"DEFAULT",
"ANY",
"call",
"create_autospec",
"AsyncMock",
"ThreadingMock",
"FILTER_DIR",
"NonCallableMock",
"NonCallableMagicMock",
"mock_open",
"PropertyMock",
"seal",
)
__version__: str
version_info: tuple[int, int, int]

View File

@@ -2,7 +2,7 @@ from _typeshed import Incomplete
from collections.abc import Callable, Coroutine, Iterable, Mapping, Sequence
from contextlib import AbstractContextManager
from types import TracebackType
from typing import Any, Generic, TypeVar, overload
from typing import Any, ClassVar, Generic, TypeVar, overload
from typing_extensions import Literal, ParamSpec, Self
_F = TypeVar("_F", bound=Callable[..., Any])
@@ -22,6 +22,7 @@ __all__ = (
"call",
"create_autospec",
"AsyncMock",
"ThreadingMock",
"FILTER_DIR",
"NonCallableMock",
"NonCallableMagicMock",
@@ -378,3 +379,17 @@ class PropertyMock(Mock):
def __set__(self, obj: Any, value: Any) -> None: ...
def seal(mock: Any) -> None: ...
class ThreadingMixin(Base):
DEFAULT_TIMEOUT: ClassVar[float | None]
def __init__(self, *args: Any, timeout: float | None = ..., **kwargs: Any) -> None: ...
def reset_mock(self, *args: Any, **kwargs: Any) -> None: ...
def wait_until_called(self, *, timeout: float | None = ...) -> None: ...
def wait_until_any_call_with(self, *args: Any, **kwargs: Any) -> None: ...
class ThreadingMock(ThreadingMixin, MagicMixin, Mock):
# Improving the `reset_mock` signature.
# It is defined on `ThreadingMixin` with `*args, **kwargs`, which is not ideal.
# But, `NonCallableMock` super-class has the better version.
def reset_mock(self, visited: Any = None, *, return_value: bool = False, side_effect: bool = False) -> None: ...