Skip to content

Releases: pytest-dev/pytest-mock

3.0.0 (2020-03-31)

31 Mar 16:46
Compare
Choose a tag to compare
  • Python 2.7 and 3.4 are no longer supported. Users using pip 9 or later will install a compatible version automatically.
  • mocker.spy now also works with async def functions (#179). Thanks @frankie567 for the PR!

2.0.0 (2020-01-04)

04 Jan 18:44
Compare
Choose a tag to compare

Breaking Changes

  • mocker.spy attributes for tracking returned values and raised exceptions of its spied functions
    are now called spy_return and spy_exception, instead of reusing the existing
    MagicMock attributes return_value and side_effect.

    Version 1.13 introduced a serious regression: after a spied function using mocker.spy
    raises an exception, further calls to the spy will not call the spied function,
    always raising the first exception instead: assigning to side_effect causes
    unittest.mock to behave this way (#175).

  • The deprecated mock alias to the mocker fixture has finally been removed.

1.13.0 (2019-12-05)

06 Dec 01:56
895efb1
Compare
Choose a tag to compare
  • The object returned by mocker.spy now also tracks any side effect of the spied method/function.

1.12.1 (2019-11-20)

22 Nov 11:03
Compare
Choose a tag to compare
  • Fix error if mocker.patch is used in code where the source file is not available, for example stale .pyc files (#169).

1.12.0 (2019-11-19)

19 Nov 12:45
Compare
Choose a tag to compare

Now all patch functions also raise a ValueError when used as a context-manager. Thanks @AlexGascon for the PR (#168).

1.11.2 (2019-10-19)

24 Oct 17:31
Compare
Choose a tag to compare
  • The pytest introspection follows message is no longer shown if there is no pytest introspection (#154).
    Thanks @The-Compiler for the report.

  • mocker now raises a ValueError when used as a context-manager.
    Thanks @binarymason for the PR (#165).

1.11.1 (2019-10-04)

11 Oct 11:10
Compare
Choose a tag to compare
  • Fix mocker.spy on Python 2 when used on non-function objects which implement __call__ #157. Thanks @pbasista for the report.

v1.11.0: mocker.spy now also tracks return value

04 Oct 11:28
Compare
Choose a tag to compare
  • mocker.spy now also tracks the return value.

mock.ANY

29 Sep 03:25
Compare
Choose a tag to compare
  • mock.ANY is now accessible from the mocker fixture (#17), thanks @tigarmo for the PR!
  • pytest-mock is now also available as a wheel. Thanks @rouge8 for the PR!

spy now supports classmethods and staticmethods

07 Jul 01:44
Compare
Choose a tag to compare

Thanks to @fogo, mocker.spy can now prey upon staticmethods and classmethods. 😄