|
| 1 | +4.0.0b1 |
| 2 | +------- |
| 3 | + |
| 4 | +- The release is a fresh cut of cpython's `4a686504`__. All changes to :mod:`mock` |
| 5 | + from that commit and before are included in this release along with the |
| 6 | + subsequent changes listed below. |
| 7 | + |
| 8 | + __ https://github.com/python/cpython/commit/4a686504eb2bbf69adf78077458508a7ba131667 |
| 9 | + |
| 10 | +- Issue #37972: Subscripts to the `unittest.mock.call` objects now receive |
| 11 | + the same chaining mechanism as any other custom attributes, so that the |
| 12 | + following usage no longer raises a `TypeError`: |
| 13 | + |
| 14 | + call().foo().__getitem__('bar') |
| 15 | + |
| 16 | + Patch by blhsing |
| 17 | + |
| 18 | +- Issue #38839: Fix some unused functions in tests. Patch by Adam Johnson. |
| 19 | + |
| 20 | +- Issue #39485: Fix a bug in :func:`unittest.mock.create_autospec` that |
| 21 | + would complain about the wrong number of arguments for custom descriptors |
| 22 | + defined in an extension module returning functions. |
| 23 | + |
| 24 | +- Issue #39082: Allow AsyncMock to correctly patch static/class methods |
| 25 | + |
| 26 | +- Issue #38093: Fixes AsyncMock so it doesn't crash when used with |
| 27 | + AsyncContextManagers or AsyncIterators. |
| 28 | + |
| 29 | +- Issue #38859: AsyncMock now returns StopAsyncIteration on the exaustion of |
| 30 | + a side_effects iterable. Since PEP-479 its Impossible to raise a |
| 31 | + StopIteration exception from a coroutine. |
| 32 | + |
| 33 | +- Issue #38163: Child mocks will now detect their type as either synchronous |
| 34 | + or asynchronous, asynchronous child mocks will be AsyncMocks and |
| 35 | + synchronous child mocks will be either MagicMock or Mock (depending on |
| 36 | + their parent type). |
| 37 | + |
| 38 | +- Issue #38473: Use signature from inner mock for autospecced methods |
| 39 | + attached with :func:`unittest.mock.attach_mock`. Patch by Karthikeyan |
| 40 | + Singaravelan. |
| 41 | + |
| 42 | +- Issue #38136: Changes AsyncMock call count and await count to be two |
| 43 | + different counters. Now await count only counts when a coroutine has been |
| 44 | + awaited, not when it has been called, and vice-versa. Update the |
| 45 | + documentation around this. |
| 46 | + |
| 47 | +- Issue #37555: Fix `NonCallableMock._call_matcher` returning tuple instead |
| 48 | + of `_Call` object when `self._spec_signature` exists. Patch by Elizabeth |
| 49 | + Uselton |
| 50 | + |
| 51 | +- Issue #37251: Remove `__code__` check in AsyncMock that incorrectly |
| 52 | + evaluated function specs as async objects but failed to evaluate classes |
| 53 | + with `__await__` but no `__code__` attribute defined as async objects. |
| 54 | + |
| 55 | +- Issue #38669: Raise :exc:`TypeError` when passing target as a string with |
| 56 | + :meth:`unittest.mock.patch.object`. |
| 57 | + |
| 58 | +- Issue #25597: Ensure, if ``wraps`` is supplied to |
| 59 | + :class:`unittest.mock.MagicMock`, it is used to calculate return values |
| 60 | + for the magic methods instead of using the default return values. Patch by |
| 61 | + Karthikeyan Singaravelan. |
| 62 | + |
| 63 | +- Issue #38108: Any synchronous magic methods on an AsyncMock now return a |
| 64 | + MagicMock. Any asynchronous magic methods on a MagicMock now return an |
| 65 | + AsyncMock. |
| 66 | + |
| 67 | +- Issue #21478: Record calls to parent when autospecced object is attached |
| 68 | + to a mock using :func:`unittest.mock.attach_mock`. Patch by Karthikeyan |
| 69 | + Singaravelan. |
| 70 | + |
| 71 | +- Issue #38857: AsyncMock fix for return values that are awaitable types. |
| 72 | + This also covers side_effect iterable values that happend to be awaitable, |
| 73 | + and wraps callables that return an awaitable type. Before these awaitables |
| 74 | + were being awaited instead of being returned as is. |
| 75 | + |
| 76 | +- Issue #38932: Mock fully resets child objects on reset_mock(). Patch by |
| 77 | + Vegard Stikbakke |
| 78 | + |
| 79 | +- Issue #37685: Fixed ``__eq__``, ``__lt__`` etc implementations in some |
| 80 | + classes. They now return :data:`NotImplemented` for unsupported type of |
| 81 | + the other operand. This allows the other operand to play role (for example |
| 82 | + the equality comparison with :data:`~unittest.mock.ANY` will return |
| 83 | + ``True``). |
| 84 | + |
| 85 | +- Issue #37212: :func:`unittest.mock.call` now preserves the order of |
| 86 | + keyword arguments in repr output. Patch by Karthikeyan Singaravelan. |
| 87 | + |
| 88 | +- Issue #37828: Fix default mock name in |
| 89 | + :meth:`unittest.mock.Mock.assert_called` exceptions. Patch by Abraham |
| 90 | + Toriz Cruz. |
| 91 | + |
| 92 | +- Issue #36871: Improve error handling for the assert_has_calls and |
| 93 | + assert_has_awaits methods of mocks. Fixed a bug where any errors |
| 94 | + encountered while binding the expected calls to the mock's spec were |
| 95 | + silently swallowed, leading to misleading error output. |
| 96 | + |
| 97 | +- Issue #21600: Fix :func:`mock.patch.stopall` to stop active patches that |
| 98 | + were created with :func:`mock.patch.dict`. |
| 99 | + |
| 100 | +- Issue #38161: Removes _AwaitEvent from AsyncMock. |
| 101 | + |
| 102 | +- Issue #36871: Ensure method signature is used instead of constructor |
| 103 | + signature of a class while asserting mock object against method calls. |
| 104 | + Patch by Karthikeyan Singaravelan. |
| 105 | + |
1 | 106 | 3.0.5
|
2 | 107 | -----
|
3 | 108 |
|
|
0 commit comments