11.10.4
2------
3
4* Fix plugin when 'terminal' plugin is disabled
5
61.10.3
7------
8
9* Fix test suite in Python 3.8. Thanks `@hroncok`_ for the report and `@blueyed`_ for the PR (`#140`_).
10
11.. _#140: https://github.com/pytest-dev/pytest-mock/pull/140
12.. _@hroncok: https://github.com/hroncok
13
141.10.2
15------
16
17* Fix bug at the end of the test session when a call to ``patch.stopall`` is done explicitly by
18  user code. Thanks `@craiga`_ for the report (`#137`_).
19
20.. _#137: https://github.com/pytest-dev/pytest-mock/issues/137
21.. _@craiga: https://github.com/craiga
22
231.10.1
24------
25
26* Fix broken links and update README. Also the code is now formatted using `black <https://github.com/ambv/black>`__.
27
281.10.0
29------
30
31* Add support for the recently added ``assert_called`` method in Python 3.6 and ``mock-2.0``. Thanks `@rouge8`_ for the PR (`#115`_).
32
33.. _#115: https://github.com/pytest-dev/pytest-mock/pull/115
34
351.9.0
36-----
37
38* Add support for the recently added ``assert_called_once`` method in Python 3.6 and ``mock-2.0``. Thanks `@rouge8`_ for the PR (`#113`_).
39
40.. _#113: https://github.com/pytest-dev/pytest-mock/pull/113
41
42
431.8.0
44-----
45
46* Add aliases for ``NonCallableMock`` and ``create_autospec`` to ``mocker``. Thanks `@mlhamel`_ for the PR (`#111`_).
47
48.. _#111: https://github.com/pytest-dev/pytest-mock/pull/111
49
501.7.1
51-----
52
53* Fix ``setup.py`` to correctly read the ``README.rst``. Thanks `@ghisvail`_ for the fix (`#107`_).
54
55.. _#107: https://github.com/pytest-dev/pytest-mock/issues/107
56
571.7.0
58-----
59
60**Incompatible change**
61
62* ``pytest-mock`` no longer supports Python 2.6 and Python 3.3, following the lead of
63  ``pytest`` and other projects in the community. Thanks `@hugovk`_ for the PR (`#96`_).
64
65**Packaging**
66
67* Fix ``mock`` requirement in Python 2. Thanks `@ghisvail`_ for the report (`#101`_).
68
69**Internal**
70
71* Some tests in ``pytest-mock``'s suite are skipped if assertion rewriting is disabled (`#102`_).
72
73.. _@ghisvail: https://github.com/ghisvail
74.. _@hugovk: https://github.com/hugovk
75.. _#96: https://github.com/pytest-dev/pytest-mock/pull/96
76.. _#101: https://github.com/pytest-dev/pytest-mock/issues/101
77.. _#102: https://github.com/pytest-dev/pytest-mock/issues/102
78
791.6.3
80-----
81
82* Fix ``UnicodeDecodeError`` during assert introspection in ``assert_called_with`` in Python 2.
83  Thanks `@AndreasHogstrom`_ for the report (`#91`_).
84
85
86.. _@AndreasHogstrom: https://github.com/AndreasHogstrom
87
88.. _#91: https://github.com/pytest-dev/pytest-mock/issues/91
89
901.6.2
91-----
92
93* Provide source package in ``tar.gz`` format and remove obsolete ``MANIFEST.in``.
94
951.6.1
96-----
97
98* Fix ``mocker.resetall()`` by ignoring mocker objects which don't have a
99  ``resetall`` method, like for example ``patch.dict``.
100  Thanks `@jdavisp3`_ for the PR (`#88`_).
101
102.. _@jdavisp3: https://github.com/jdavisp3
103
104.. _#88: https://github.com/pytest-dev/pytest-mock/pull/88
105
1061.6.0
107-----
108
109* The original assertions raised by the various ``Mock.assert_*`` methods
110  now appear in the failure message, in addition to the message obtained from
111  pytest introspection.
112  Thanks `@quodlibetor`_ for the initial patch (`#79`_).
113
114.. _@quodlibetor: https://github.com/quodlibetor
115
116.. _#79: https://github.com/pytest-dev/pytest-mock/pull/79
117
1181.5.0
119-----
120
121* New ``mocker.mock_module`` variable points to the underlying mock module being used
122  (``unittest.mock`` or ``mock``).
123  Thanks `@blueyed`_ for the request (`#71`_).
124
125.. _#71: https://github.com/pytest-dev/pytest-mock/pull/71
126
1271.4.0
128-----
129
130* New configuration variable, ``mock_use_standalone_module`` (defaults to ``False``). This forces
131  the plugin to import ``mock`` instead of ``unittest.mock`` on Python 3. This is useful to import
132  a newer version than the one available in the Python distribution.
133
134* Previously the plugin would first try to import ``mock`` and fallback to ``unittest.mock``
135  in case of an ``ImportError``, but this behavior has been removed because it could hide
136  hard to debug import errors (`#68`_).
137
138* Now ``mock`` (Python 2) and ``unittest.mock`` (Python 3) are lazy-loaded to make it possible to
139  implement the new ``mock_use_standlone_module`` configuration option. As a consequence of this
140  the undocumented ``pytest_mock.mock_module`` variable, which pointed to the actual mock module
141  being used by the plugin, has been removed.
142
143* `DEFAULT <https://docs.python.org/3/library/unittest.mock.html#default>`_ is now available from
144  the ``mocker`` fixture.
145
146.. _#68: https://github.com/pytest-dev/pytest-mock/issues/68
147
1481.3.0
149-----
150
151* Add support for Python 3.6. Thanks `@hackebrot`_ for the report (`#59`_).
152
153* ``mock.mock_open`` is now aliased as ``mocker.mock_open`` for convenience.
154  Thanks `@pokidovea`_ for the PR (`#66`_).
155
156.. _@hackebrot: https://github.com/hackebrot
157.. _@pokidovea: https://github.com/pokidovea
158.. _#59: https://github.com/pytest-dev/pytest-mock/issues/59
159.. _#66: https://github.com/pytest-dev/pytest-mock/pull/66
160
1611.2
162---
163
164* Try to import ``mock`` first instead of ``unittest.mock``. This gives the user flexibility
165  to install a newer ``mock`` version from PyPI instead of using the one available in the
166  Python distribution.
167  Thanks `@wcooley`_ for the PR (`#54`_).
168
169* ``mock.sentinel`` is now aliased as ``mocker.sentinel`` for convenience.
170  Thanks `@kjwilcox`_ for the PR (`#56`_).
171
172.. _@wcooley: https://github.com/wcooley
173.. _@kjwilcox: https://github.com/kjwilcox
174.. _#54: https://github.com/pytest-dev/pytest-mock/issues/54
175.. _#56: https://github.com/pytest-dev/pytest-mock/pull/56
176
1771.1
178---
179
180* From this version onward, ``pytest-mock`` is licensed under the `MIT`_ license (`#45`_).
181
182* Now the plugin also adds introspection information on differing call arguments when
183  calling helper methods such as ``assert_called_once_with``. The extra introspection
184  information is similar to pytest's and can be disabled with the ``mock_traceback_monkeypatch``
185  option.
186  Thanks `@asfaltboy`_ for the PR (`#36`_).
187
188* ``mocker.stub()`` now allows passing in the name for the constructed `Mock
189  <https://docs.python.org/3/library/unittest.mock.html#the-mock-class>`_
190  object instead of having to set it using the internal ``_mock_name`` attribute
191  directly. This is useful for debugging as the name is used in the mock's
192  ``repr`` string as well as related assertion failure messages.
193  Thanks `@jurko-gospodnetic`_ for the PR (`#40`_).
194
195* Monkey patching ``mock`` module for friendlier tracebacks is automatically disabled
196  with the ``--tb=native`` option. The underlying
197  mechanism used to suppress traceback entries from ``mock`` module does not work with that option
198  anyway plus it generates confusing messages on Python 3.5 due to exception chaining (`#44`_).
199  Thanks `@blueyed`_ for the report.
200
201* ``mock.call`` is now aliased as ``mocker.call`` for convenience.
202  Thanks `@jhermann`_ for the PR (`#49`_).
203
204.. _@jurko-gospodnetic: https://github.com/jurko-gospodnetic
205.. _@asfaltboy: https://github.com/asfaltboy
206.. _@jhermann: https://github.com/jhermann
207.. _#45: https://github.com/pytest-dev/pytest-mock/issues/45
208.. _#36: https://github.com/pytest-dev/pytest-mock/issues/36
209.. _#40: https://github.com/pytest-dev/pytest-mock/issues/40
210.. _#44: https://github.com/pytest-dev/pytest-mock/issues/44
211.. _#49: https://github.com/pytest-dev/pytest-mock/issues/49
212.. _MIT: https://github.com/pytest-dev/pytest-mock/blob/master/LICENSE
213
214
2151.0
216---
217
218* Fix AttributeError with ``mocker.spy`` when spying on inherited methods
219  (`#42`_). Thanks `@blueyed`_ for the PR.
220
221.. _@blueyed: https://github.com/blueyed
222.. _#42: https://github.com/pytest-dev/pytest-mock/issues/42
223
2240.11.0
225------
226
227* `PropertyMock <https://docs.python.org/3/library/unittest.mock.html#unittest.mock.PropertyMock>`_
228  is now accessible from ``mocker``.
229  Thanks `@satyrius`_ for the PR (`#32`_).
230
231* Fix regression using one of the ``assert_*`` methods in patched
232  functions which receive a parameter named ``method``.
233  Thanks `@sagarchalise`_ for the report (`#31`_).
234
235.. _@sagarchalise: https://github.com/sagarchalise
236.. _@satyrius: https://github.com/satyrius
237.. _#31: https://github.com/pytest-dev/pytest-mock/issues/31
238.. _#32: https://github.com/pytest-dev/pytest-mock/issues/32
239
2400.10.1
241------
242
243* Fix regression in frozen tests due to ``distutils`` import dependency.
244  Thanks `@The-Compiler`_ for the report (`#29`_).
245
246* Fix regression when using ``pytest-mock`` with ``pytest-2.7.X``.
247  Thanks `@akscram`_ for the report (`#28`_).
248
249.. _@akscram: https://github.com/Chronial
250.. _#28: https://github.com/pytest-dev/pytest-mock/issues/28
251.. _#29: https://github.com/pytest-dev/pytest-mock/issues/29
252
2530.10
254----
255
256* ``pytest-mock`` now monkeypatches the ``mock`` library to improve pytest output
257  for failures of mock call assertions like ``Mock.assert_called_with()``.
258  Thanks to `@Chronial`_ for idea and PR (`#26`_, `#27`_)!
259
260.. _@Chronial: https://github.com/Chronial
261.. _#26: https://github.com/pytest-dev/pytest-mock/issues/26
262.. _#27: https://github.com/pytest-dev/pytest-mock/issues/27
263
2640.9.0
265-----
266
267* New ``mocker.resetall`` function, which calls ``reset_mock()`` in all mocked
268  objects up to that point. Thanks to `@mathrick`_ for the PR!
269
2700.8.1
271-----
272
273* ``pytest-mock`` is now also available as a wheel. Thanks `@rouge8`_ for the PR!
274
2750.8.0
276-----
277
278* ``mock.ANY`` is now accessible from the mocker fixture (`#17`_), thanks `@tigarmo`_ for the PR!
279
280.. _#17: https://github.com/pytest-dev/pytest-qt/issues/17
281
2820.7.0
283-----
284
285Thanks to `@fogo`_, mocker.spy can now prey upon staticmethods and classmethods. :smile:
286
2870.6.0
288-----
289
290* Two new auxiliary methods, ``spy`` and ``stub``. See ``README`` for usage.
291  (Thanks `@fogo`_ for complete PR!)
292
293
2940.5.0
295-----
296
297* ``Mock`` and ``MagicMock`` are now accessible from the ``mocker`` fixture,
298  many thanks to `@marcwebbie`_ for the complete PR!
299
3000.4.3
301-----
302
303* ``mocker`` fixture now returns the same object (`#8`_). Many thanks to `@RonnyPfannschmidt`_ for the PR!
304
305.. _#8: https://github.com/pytest-dev/pytest-qt/issues/8
306
3070.4.2
308-----
309
310* Small fix, no longer using wheel as an alternate package since it
311  conditionally depends on mock module based on Python version,
312  as Python >= 3.3 already includes ``unittest.mock``.
313  Many thanks to `@The-Compiler`_ for letting me know and providing a PR with the fix!
314
3150.4.1
316-----
317
318* Small release that just uses ``pytest_mock`` as the name of the plugin,
319  instead of ``pytest-mock``: this makes it simple to depend on this plugin
320  explicitly using ``pytest_plugins`` module variable mechanism.
321
3220.4.0
323-----
324
325* Changed fixture name from ``mock`` into ``mocker`` because it conflicted
326  with the actual mock module, which made using it awkward when access to both
327  the module and the fixture were required within a test.
328
329  Thanks `@kmosher`_ for request and discussion in `#4`_. :smile:
330
331.. _#4: https://github.com/pytest-dev/pytest-qt/issues/4
332
333
3340.3.0
335-----
336
337* Fixed bug `#2`_, where a patch would not be uninstalled correctly after
338  patching the same object twice.
339
3400.2.0
341-----
342
343* Added ``patch.dict`` support.
344
3450.1.0
346-----
347
348First release.
349
350.. _#2: https://github.com/pytest-dev/pytest-qt/issues/2
351
352.. _@fogo: https://github.com/fogo
353.. _@kmosher: https://github.com/kmosher
354.. _@marcwebbie: https://github.com/marcwebbie
355.. _@mathrick: https://github.com/mathrick
356.. _@mlhamel: https://github.com/mlhamel
357.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
358.. _@rouge8: https://github.com/rouge8
359.. _@The-Compiler: https://github.com/The-Compiler
360.. _@tigarmo: https://github.com/tigarmo
361