Preparing for 5.2.0 release.
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6e8b697..21cd287 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst
@@ -1,3 +1,43 @@ +5.2.0 +----- + +- gh-65454: :func:`unittest.mock.Mock.attach_mock` no longer triggers a call + to a ``PropertyMock`` being attached. + +- gh-117765: Improved documentation for :func:`unittest.mock.patch.dict` + +- gh-124176: Add support for :func:`dataclasses.dataclass` in + :func:`unittest.mock.create_autospec`. Now ``create_autospec`` will check + for potential dataclasses and use :func:`dataclasses.fields` function to + retrieve the spec information. + +- gh-123934: Fix :class:`unittest.mock.MagicMock` reseting magic methods + return values after ``.reset_mock(return_value=True)`` was called. + +- gh-90848: Fixed :func:`unittest.mock.create_autospec` to configure parent + mock with keyword arguments. + +- gh-113569: Indicate if there were no actual calls in unittest + :meth:`~unittest.mock.Mock.assert_has_calls` failure. + +- gh-122858: Deprecate :func:`!asyncio.iscoroutinefunction` in favor of + :func:`inspect.iscoroutinefunction`. + +- gh-104745: Limit starting a patcher (from :func:`unittest.mock.patch` or + :func:`unittest.mock.patch.object`) more than once without stopping it + +- gh-75988: Fixed :func:`unittest.mock.create_autospec` to pass the call + through to the wrapped object to return the real result. + +- gh-119600: Fix :func:`unittest.mock.patch` to not read attributes of the + target when ``new_callable`` is set. Patch by Robert Collins. + +- gh-113407: Fix import of :mod:`unittest.mock` when CPython is built + without docstrings. + +- gh-120732: Fix ``name`` passing to :class:`unittest.mock.Mock` object when + using :func:`unittest.mock.create_autospec`. + 5.1.0 -----
diff --git a/NEWS.d/2023-12-22-20-49-52.gh-issue-113407.C_O13_.rst b/NEWS.d/2023-12-22-20-49-52.gh-issue-113407.C_O13_.rst deleted file mode 100644 index da00977..0000000 --- a/NEWS.d/2023-12-22-20-49-52.gh-issue-113407.C_O13_.rst +++ /dev/null
@@ -1 +0,0 @@ -Fix import of :mod:`unittest.mock` when CPython is built without docstrings.
diff --git a/NEWS.d/2023-12-29-17-57-45.gh-issue-113569.qcRCEI.rst b/NEWS.d/2023-12-29-17-57-45.gh-issue-113569.qcRCEI.rst deleted file mode 100644 index 9b63fc9..0000000 --- a/NEWS.d/2023-12-29-17-57-45.gh-issue-113569.qcRCEI.rst +++ /dev/null
@@ -1,2 +0,0 @@ -Indicate if there were no actual calls in unittest -:meth:`~unittest.mock.Mock.assert_has_calls` failure.
diff --git a/NEWS.d/2024-02-27-13-05-51.gh-issue-75988.In6LlB.rst b/NEWS.d/2024-02-27-13-05-51.gh-issue-75988.In6LlB.rst deleted file mode 100644 index 682b7cf..0000000 --- a/NEWS.d/2024-02-27-13-05-51.gh-issue-75988.In6LlB.rst +++ /dev/null
@@ -1 +0,0 @@ -Fixed :func:`unittest.mock.create_autospec` to pass the call through to the wrapped object to return the real result.
diff --git a/NEWS.d/2024-04-22-21-54-12.gh-issue-90848.5jHEEc.rst b/NEWS.d/2024-04-22-21-54-12.gh-issue-90848.5jHEEc.rst deleted file mode 100644 index adbca01..0000000 --- a/NEWS.d/2024-04-22-21-54-12.gh-issue-90848.5jHEEc.rst +++ /dev/null
@@ -1 +0,0 @@ -Fixed :func:`unittest.mock.create_autospec` to configure parent mock with keyword arguments.
diff --git a/NEWS.d/2024-06-04-08-57-02.gh-issue-65454.o9j4wF.rst b/NEWS.d/2024-06-04-08-57-02.gh-issue-65454.o9j4wF.rst deleted file mode 100644 index 0b232cf..0000000 --- a/NEWS.d/2024-06-04-08-57-02.gh-issue-65454.o9j4wF.rst +++ /dev/null
@@ -1 +0,0 @@ -:func:`unittest.mock.Mock.attach_mock` no longer triggers a call to a ``PropertyMock`` being attached.
diff --git a/NEWS.d/2024-06-10-14-00-40.gh-issue-119600.jJMf4C.rst b/NEWS.d/2024-06-10-14-00-40.gh-issue-119600.jJMf4C.rst deleted file mode 100644 index 04c9ca9..0000000 --- a/NEWS.d/2024-06-10-14-00-40.gh-issue-119600.jJMf4C.rst +++ /dev/null
@@ -1,2 +0,0 @@ -Fix :func:`unittest.mock.patch` to not read attributes of the target when -``new_callable`` is set. Patch by Robert Collins.
diff --git a/NEWS.d/2024-06-19-15-06-58.gh-issue-120732.OvYV9b.rst b/NEWS.d/2024-06-19-15-06-58.gh-issue-120732.OvYV9b.rst deleted file mode 100644 index e31c4dd..0000000 --- a/NEWS.d/2024-06-19-15-06-58.gh-issue-120732.OvYV9b.rst +++ /dev/null
@@ -1,2 +0,0 @@ -Fix ``name`` passing to :class:`unittest.mock.Mock` object when using -:func:`unittest.mock.create_autospec`.
diff --git a/NEWS.d/2024-07-14-12-25-53.gh-issue-117765.YFMOUv.rst b/NEWS.d/2024-07-14-12-25-53.gh-issue-117765.YFMOUv.rst deleted file mode 100644 index a727c1a..0000000 --- a/NEWS.d/2024-07-14-12-25-53.gh-issue-117765.YFMOUv.rst +++ /dev/null
@@ -1 +0,0 @@ -Improved documentation for :func:`unittest.mock.patch.dict`
diff --git a/NEWS.d/2024-08-10-10-21-44.gh-issue-122858.ZC1rJD.rst b/NEWS.d/2024-08-10-10-21-44.gh-issue-122858.ZC1rJD.rst deleted file mode 100644 index d452ad6..0000000 --- a/NEWS.d/2024-08-10-10-21-44.gh-issue-122858.ZC1rJD.rst +++ /dev/null
@@ -1,2 +0,0 @@ -Deprecate :func:`!asyncio.iscoroutinefunction` in favor of -:func:`inspect.iscoroutinefunction`.
diff --git a/NEWS.d/2024-09-13-10-34-19.gh-issue-123934.yMe7mL.rst b/NEWS.d/2024-09-13-10-34-19.gh-issue-123934.yMe7mL.rst deleted file mode 100644 index cec7741..0000000 --- a/NEWS.d/2024-09-13-10-34-19.gh-issue-123934.yMe7mL.rst +++ /dev/null
@@ -1,2 +0,0 @@ -Fix :class:`unittest.mock.MagicMock` reseting magic methods return values -after ``.reset_mock(return_value=True)`` was called.
diff --git a/NEWS.d/2024-09-24-13-32-16.gh-issue-124176.6hmOPz.rst b/NEWS.d/2024-09-24-13-32-16.gh-issue-124176.6hmOPz.rst deleted file mode 100644 index 38c0306..0000000 --- a/NEWS.d/2024-09-24-13-32-16.gh-issue-124176.6hmOPz.rst +++ /dev/null
@@ -1,4 +0,0 @@ -Add support for :func:`dataclasses.dataclass` in -:func:`unittest.mock.create_autospec`. Now ``create_autospec`` will check -for potential dataclasses and use :func:`dataclasses.fields` function to -retrieve the spec information.
diff --git a/NEWS.d/2024-11-10-18-14-51.gh-issue-104745.zAa5Ke.rst b/NEWS.d/2024-11-10-18-14-51.gh-issue-104745.zAa5Ke.rst deleted file mode 100644 index c83a107..0000000 --- a/NEWS.d/2024-11-10-18-14-51.gh-issue-104745.zAa5Ke.rst +++ /dev/null
@@ -1,3 +0,0 @@ -Limit starting a patcher (from :func:`unittest.mock.patch` or -:func:`unittest.mock.patch.object`) more than -once without stopping it
diff --git a/mock/__init__.py b/mock/__init__.py index 9c4e2d0..055601d 100644 --- a/mock/__init__.py +++ b/mock/__init__.py
@@ -7,7 +7,7 @@ import mock.mock as _mock from mock.mock import * -__version__ = '5.1.0' +__version__ = '5.2.0' version_info = tuple(int(p) for p in re.match(r'(\d+).(\d+).(\d+)', __version__).groups())