CHANGELOG.rst 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. 3.0.5
  2. -----
  3. - Issue #31855: :func:`unittest.mock.mock_open` results now respects the
  4. argument of read([size]). Patch contributed by Rémi Lapeyre.
  5. 3.0.4
  6. -----
  7. - Include the license, readme and changelog in the source distribution.
  8. 3.0.3
  9. -----
  10. - Fixed patching of dictionaries, when specifying the target with a
  11. unicode on Python 2.
  12. 3.0.2
  13. -----
  14. - Add missing ``funcsigs`` dependency on Python 2.
  15. 3.0.1
  16. -----
  17. - Fix packaging issue where ``six`` was missed as a dependency.
  18. 3.0.0
  19. -----
  20. - Issue #35226: Recursively check arguments when testing for equality of
  21. :class:`unittest.mock.call` objects and add note that tracking of
  22. parameters used to create ancestors of mocks in ``mock_calls`` is not
  23. possible.
  24. - Issue #31177: Fix bug that prevented using :meth:`reset_mock
  25. <unittest.mock.Mock.reset_mock>` on mock instances with deleted attributes
  26. - Issue #26704: Added test demonstrating double-patching of an instance
  27. method. Patch by Anthony Sottile.
  28. - Issue #35500: Write expected and actual call parameters on separate lines
  29. in :meth:`unittest.mock.Mock.assert_called_with` assertion errors.
  30. Contributed by Susan Su.
  31. - Issue #35330: When a :class:`Mock` instance was used to wrap an object, if
  32. `side_effect` is used in one of the mocks of it methods, don't call the
  33. original implementation and return the result of using the side effect the
  34. same way that it is done with return_value.
  35. - Issue #30541: Add new function to seal a mock and prevent the
  36. automatically creation of child mocks. Patch by Mario Corchero.
  37. - Issue #35022: :class:`unittest.mock.MagicMock` now supports the
  38. ``__fspath__`` method (from :class:`os.PathLike`).
  39. - Issue #33516: :class:`unittest.mock.MagicMock` now supports the
  40. ``__round__`` magic method.
  41. - Issue #35512: :func:`unittest.mock.patch.dict` used as a decorator with
  42. string target resolves the target during function call instead of during
  43. decorator construction. Patch by Karthikeyan Singaravelan.
  44. - Issue #36366: Calling ``stop()`` on an unstarted or stopped
  45. :func:`unittest.mock.patch` object will now return `None` instead of
  46. raising :exc:`RuntimeError`, making the method idempotent. Patch
  47. byKarthikeyan Singaravelan.
  48. - Issue #35357: Internal attributes' names of unittest.mock._Call and
  49. unittest.mock.MagicProxy (name, parent & from_kall) are now prefixed with
  50. _mock_ in order to prevent clashes with widely used object attributes.
  51. Fixed minor typo in test function name.
  52. - Issue #20239: Allow repeated assignment deletion of
  53. :class:`unittest.mock.Mock` attributes. Patch by Pablo Galindo.
  54. - Issue #35082: Don't return deleted attributes when calling dir on a
  55. :class:`unittest.mock.Mock`.
  56. - Issue #0: Improved an error message when mock assert_has_calls fails.
  57. - Issue #23078: Add support for :func:`classmethod` and :func:`staticmethod`
  58. to :func:`unittest.mock.create_autospec`. Initial patch by Felipe Ochoa.
  59. - Issue #21478: Calls to a child function created with
  60. :func:`unittest.mock.create_autospec` should propagate to the parent.
  61. Patch by Karthikeyan Singaravelan.
  62. - Issue #36598: Fix ``isinstance`` check for Mock objects with spec when the
  63. code is executed under tracing. Patch by Karthikeyan Singaravelan.
  64. - Issue #32933: :func:`unittest.mock.mock_open` now supports iteration over
  65. the file contents. Patch by Tony Flury.
  66. - Issue #21269: Add ``args`` and ``kwargs`` properties to mock call objects.
  67. Contributed by Kumar Akshay.
  68. - Issue #17185: Set ``__signature__`` on mock for :mod:`inspect` to get
  69. signature. Patch by Karthikeyan Singaravelan.
  70. - Issue #35047: ``unittest.mock`` now includes mock calls in exception
  71. messages if ``assert_not_called``, ``assert_called_once``, or
  72. ``assert_called_once_with`` fails. Patch by Petter Strandmark.
  73. - Issue #28380: unittest.mock Mock autospec functions now properly support
  74. assert_called, assert_not_called, and assert_called_once.
  75. - Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY.
  76. - Issue #20804: The unittest.mock.sentinel attributes now preserve their
  77. identity when they are copied or pickled.
  78. - Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter
  79. anymore. Patch written by Jiajun Huang.
  80. - Issue #26750: unittest.mock.create_autospec() now works properly for
  81. subclasses of property() and other data descriptors.
  82. - Issue #21271: New keyword only parameters in reset_mock call.
  83. - Issue #26807: mock_open 'files' no longer error on readline at end of file.
  84. Patch from Yolanda Robla.
  85. - Issue #25195: Fix a regression in mock.MagicMock. _Call is a subclass of
  86. tuple (changeset 3603bae63c13 only works for classes) so we need to
  87. implement __ne__ ourselves. Patch by Andrew Plummer.
  88. 2.0.0 and earlier
  89. -----------------
  90. - Issue #26323: Add Mock.assert_called() and Mock.assert_called_once()
  91. methods to unittest.mock. Patch written by Amit Saha.
  92. - Issue #22138: Fix mock.patch behavior when patching descriptors. Restore
  93. original values after patching. Patch contributed by Sean McCully.
  94. - Issue #24857: Comparing call_args to a long sequence now correctly returns a
  95. boolean result instead of raising an exception. Patch by A Kaptur.
  96. - Issue #23004: mock_open() now reads binary data correctly when the type of
  97. read_data is bytes. Initial patch by Aaron Hill.
  98. - Issue #21750: mock_open.read_data can now be read from each instance, as it
  99. could in Python 3.3.
  100. - Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely.
  101. Patch from Nicola Palumbo and Laurent De Buyst.
  102. - Issue #23661: unittest.mock side_effects can now be exceptions again. This
  103. was a regression vs Python 3.4. Patch from Ignacio Rossi
  104. - Issue #23310: Fix MagicMock's initializer to work with __methods__, just
  105. like configure_mock(). Patch by Kasia Jachim.
  106. - Issue #23568: Add rdivmod support to MagicMock() objects.
  107. Patch by Håkan Lövdahl.
  108. - Issue #23581: Add matmul support to MagicMock. Patch by Håkan Lövdahl.
  109. - Issue #23326: Removed __ne__ implementations. Since fixing default __ne__
  110. implementation in issue #21408 they are redundant. *** NOT BACKPORTED ***
  111. - Issue #21270: We now override tuple methods in mock.call objects so that
  112. they can be used as normal call attributes.
  113. - Issue #21256: Printout of keyword args should be in deterministic order in
  114. a mock function call. This will help to write better doctests.
  115. - Issue #21262: New method assert_not_called for Mock.
  116. It raises AssertionError if the mock has been called.
  117. - Issue #21238: New keyword argument `unsafe` to Mock. It raises
  118. `AttributeError` incase of an attribute startswith assert or assret.
  119. - Issue #21239: patch.stopall() didn't work deterministically when the same
  120. name was patched more than once.
  121. - Issue #21222: Passing name keyword argument to mock.create_autospec now
  122. works.
  123. - Issue #17826: setting an iterable side_effect on a mock function created by
  124. create_autospec now works. Patch by Kushal Das.
  125. - Issue #17826: setting an iterable side_effect on a mock function created by
  126. create_autospec now works. Patch by Kushal Das.
  127. - Issue #20968: unittest.mock.MagicMock now supports division.
  128. Patch by Johannes Baiter.
  129. - Issue #20189: unittest.mock now no longer assumes that any object for
  130. which it could get an inspect.Signature is a callable written in Python.
  131. Fix courtesy of Michael Foord.
  132. - Issue #17467: add readline and readlines support to mock_open in
  133. unittest.mock.
  134. - Issue #17015: When it has a spec, a Mock object now inspects its signature
  135. when matching calls, so that arguments can be matched positionally or
  136. by name.
  137. - Issue #15323: improve failure message of Mock.assert_called_once_with
  138. - Issue #14857: fix regression in references to PEP 3135 implicit __class__
  139. closure variable (Reopens issue #12370)
  140. - Issue #14295: Add unittest.mock