Skip to content

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 12, 2021

This PR contains the following updates:

Package Change Age Confidence
pytest-mock (changelog) ==1.13.0 -> ==3.15.1 age confidence

⚠️ MAJOR MAJOR MAJOR ⚠️


Release Notes

pytest-dev/pytest-mock (pytest-mock)

v3.15.1

Compare Source

2025-09-16

  • #&#8203;529 <https://github.com/pytest-dev/pytest-mock/issues/529>_: Fixed itertools._tee object has no attribute error -- now duplicate_iterators=True must be passed to mocker.spy to duplicate iterators.

v3.15.0

Compare Source

2025-09-04

  • Python 3.8 (EOL) is no longer supported.
  • #&#8203;524 <https://github.com/pytest-dev/pytest-mock/pull/524>_: Added spy_return_iter to mocker.spy, which contains a duplicate of the return value of the spied method if it is an Iterator.

v3.14.1

Compare Source

  • #&#8203;503 <https://github.com/pytest-dev/pytest-mock/pull/503>_: Python 3.14 is now officially supported.

v3.14.0

Compare Source

  • #&#8203;415 <https://github.com/pytest-dev/pytest-mock/pull/415>_: MockType and AsyncMockType can be imported from pytest_mock for type annotation purposes.

  • #&#8203;420 <https://github.com/pytest-dev/pytest-mock/issues/420>_: Fixed a regression which would cause mocker.patch.object to not being properly cleared between tests.

v3.13.0

Compare Source

  • #&#8203;417 <https://github.com/pytest-dev/pytest-mock/pull/417>_: spy now has spy_return_list, which is a list containing all the values returned by the spied function.
  • pytest-mock now requires pytest>=6.2.5.
  • #&#8203;410 <https://github.com/pytest-dev/pytest-mock/pull/410>: pytest-mock's setup.py file is removed.
    If you relied on this file, e.g. to install pytest using setup.py install,
    please see Why you shouldn't invoke setup.py directly <https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary>
    for alternatives.

v3.12.0

Compare Source

  • Added support for Python 3.12.
  • Dropped support for EOL Python 3.7.
  • mocker.resetall() now also resets mocks created by mocker.create_autospec (#390_).

.. _#390: #​390

v3.11.1

Compare Source

(This release source code is identical to 3.11.0 except a small internal fix to deployment/CI)

  • Fixed introspection for failed assert_has_calls (#365_).

  • Updated type annotations for mocker.patch and mocker.spy (#364_).

.. _#365: #​365
.. _#364: #​364

v3.11.0

Compare Source

  • Fixed introspection for failed assert_has_calls (#365_).

  • Updated type annotations for mocker.patch and mocker.spy (#364_).

.. _#365: #​365
.. _#364: #​364

v3.10.0

Compare Source

  • Added new mocker.stop(m) method to stop specific mocker.patch or mocker.spy calls (#319_).

.. _#319: #​319

v3.9.0

Compare Source

  • Expose NonCallableMagicMock via the mocker fixture (#318_).

.. _#318: #​318

v3.8.2

Compare Source

  • Fixed AsyncMock support for Python 3.7+ in mocker.async_stub (#302_).

.. _#302: #​302

v3.8.1

Compare Source

  • Fixed regression caused by an explicit mock dependency in the code (#298_).

.. _#298: #​298

v3.8.0

Compare Source

  • Add MockerFixture.async_mock method. Thanks @PerchunPak_ for the PR (#296_).

.. _@​PerchunPak: https://github.com/PerchunPak
.. _#296: #​296

v3.7.0

Compare Source

  • Python 3.10 now officially supported.
  • Dropped support for Python 3.6.

v3.6.1

Compare Source

  • Fix mocker.resetall() when using mocker.spy() (#237). Thanks @blaxter for the report and @shadycuz_ for the PR.

.. _@​blaxter: https://github.com/blaxter
.. _@​shadycuz: https://github.com/shadycuz
.. _#237: #​237

v3.6.0

Compare Source

  • pytest-mock no longer supports Python 3.5.

  • Correct type annotations for mocker.patch.object to also include the string form.
    Thanks @plannigan_ for the PR (#235_).

  • reset_all now supports return_value and side_effect keyword arguments. Thanks @alex-marty_ for the PR (#214_).

.. _@​alex-marty: https://github.com/alex-marty
.. _@​plannigan: https://github.com/plannigan
.. _#214: #​214
.. _#235: #​235

v3.5.1

Compare Source

  • Use inspect.getattr_static instead of resorting to object.__getattribute__
    magic. This should better comply with objects which implement a custom descriptor
    protocol. Thanks @yesthesoup_ for the PR (#224_).

.. _@​yesthesoup: https://github.com/yesthesoup
.. _#224: #​224

v3.5.0

Compare Source

  • Now all patch functions will emit a warning instead of raising a ValueError when used
    as a context-manager. Thanks @iforapsy_ for the PR (#221_).

  • Additionally, mocker.patch.context_manager is available when the user intends to mock
    a context manager (for example threading.Lock object), which will not emit that
    warning.

.. _@​iforapsy: https://github.com/iforapsy
.. _#221: #​221

v3.4.0

Compare Source

  • Add mock.seal alias to the mocker fixture (#211). Thanks @coiax for the PR.

  • Fixed spying on exceptions not covered by the Exception
    superclass (#215), like KeyboardInterrupt -- PR #216
    by @webknjaz_.

    Before the fix, both spy_return and spy_exception
    were always assigned to None
    whenever such an exception happened. And after this fix,
    spy_exception is set to a correct value of an exception
    that has actually happened.

.. _@​coiax: https://github.com/coiax
.. _@​webknjaz: https://github.com/sponsors/webknjaz
.. _#211: #​211
.. _#215: #​215
.. _#216: #​216

v3.3.1

Compare Source

  • Introduce MockFixture as an alias to MockerFixture.

    Before 3.3.0, the fixture class was named MockFixture, but was renamed to MockerFixture to better
    match the mocker fixture. While not officially part of the API, it was later discovered that this broke
    the code of some users which already imported pytest_mock.MockFixture for type annotations, so we
    decided to reintroduce the name as an alias.

    Note however that this is just a stop gap measure, and new code should use MockerFixture for type annotations.

  • Improved typing for MockerFixture.patch (#201). Thanks @srittau for the PR.

.. _@​srittau: https://github.com/srittau
.. _#201: #​201

v3.3.0

Compare Source

  • pytest-mock now includes inline type annotations and exposes them to user programs. The mocker fixture returns pytest_mock.MockerFixture, which can be used to annotate your tests:

    .. code-block:: python

      from pytest_mock import MockerFixture
    
      def test_foo(mocker: MockerFixture) -> None:
          ...
    

    The type annotations were developed against mypy version 0.782, the
    minimum version supported at the moment. If you run into an error that you believe to be incorrect, please open an issue.

    Many thanks to @staticdev_ for providing the initial patch (#199_).

.. _@​staticdev: https://github.com/staticdev
.. _#199: #​199

v3.2.0

Compare Source

  • AsyncMock <https://docs.python.org/3/library/unittest.mock.html#unittest.mock.AsyncMock>__ is now exposed in mocker and supports provides assertion introspection similar to Mock objects.

    Added by @tirkarthi_ in #197_.

.. _@​tirkarthi: https://github.com/tirkarthi
.. _#197: #​197

v3.1.1

Compare Source

  • Fixed performance regression caused by the ValueError raised
    when mocker is used as context manager (#191_).

.. _#191: #​191

v3.1.0

Compare Source

  • New mocker fixtures added that allow using mocking functionality in other scopes:

    • class_mocker
    • module_mocker
    • package_mocker
    • session_mocker

    Added by @scorphus_ in #182_.

.. _@​scorphus: https://github.com/scorphus
.. _#182: #​182

v3.0.0

Compare Source

  • 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!

.. _#179: #​179
.. _@​frankie567: https://github.com/frankie567

v2.0.0

Compare Source

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.

.. _#175: #​175


Configuration

📅 Schedule: Branch creation - "after 10:30 before 18:00 every weekday except after 13:00 before 14:00" in timezone America/Lima, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependencies Pull requests that update a dependency file label Nov 12, 2021
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch from b270845 to 8ca6984 Compare March 7, 2022 13:28
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch 2 times, most recently from d4de2f2 to 8296681 Compare June 24, 2022 21:20
@renovate renovate bot changed the title ci(deps): Update dependency pytest-mock to v3 ci(deps): ci(deps): Update dependency pytest-mock to v3 Jun 27, 2022
@renovate renovate bot changed the title ci(deps): ci(deps): Update dependency pytest-mock to v3 ci(deps): Update dependency pytest-mock to v3 Jun 28, 2022
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch from 8296681 to b00c9e1 Compare July 5, 2022 15:32
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch from b00c9e1 to 666d2c0 Compare November 20, 2022 08:29
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch from 666d2c0 to 031d715 Compare June 16, 2023 02:24
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch from 031d715 to ba1235b Compare October 19, 2023 17:29
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch 2 times, most recently from c5d8bc4 to 09658b0 Compare March 22, 2024 01:37
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch from 09658b0 to 6ab6824 Compare May 26, 2025 15:01
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch from 6ab6824 to 031d606 Compare September 5, 2025 00:59
@renovate renovate bot force-pushed the renovate/pytest-mock-3.x branch from 031d606 to 41f2415 Compare September 16, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants