Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency pytest-mock to v3 #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mend-for-github-com[bot]
Copy link

@mend-for-github-com mend-for-github-com bot commented Feb 21, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
pytest-mock (changelog) ==1.2 -> ==3.14.0 age adoption passing confidence

Release Notes

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

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:https://github.com/pytest-dev/pytest-mock/pull/3900

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:https://github.com/pytest-dev/pytest-mock/pull/3655
.. _#364https://github.com/pytest-dev/pytest-mock/pull/36464

v3.11.0

Compare Source

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

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

.. _#365:https://github.com/pytest-dev/pytest-mock/pull/3655
.. _#364https://github.com/pytest-dev/pytest-mock/pull/36464

v3.10.0

Compare Source

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

.. _#319:https://github.com/pytest-dev/pytest-mock/pull/3199

v3.9.0

Compare Source

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

.. _#318:https://github.com/pytest-dev/pytest-mock/pull/3188

v3.8.2

Compare Source

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

.. _#302:https://github.com/pytest-dev/pytest-mock/pull/3022

v3.8.1

Compare Source

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

.. _#298:https://github.com/pytest-dev/pytest-mock/issues/2988

v3.8.0

Compare Source

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

.. _@​PerchunPak: https://github.com/PerchunPak
.. https://github.com/pytest-dev/pytest-mock/pull/296pull/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/shady[https://github.com/pytest-dev/pytest-mock/issues/237](https://togithub.com/pytest-dev/pytest-mock/issues/237)mock/issues/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/planni[https://github.com/pytest-dev/pytest-mock/pull/214](https://togithub.com/pytest-dev/pytest-mock/pull/214)t-mock/pull[https://github.com/pytest-dev/pytest-mock/pull/235](https://togithub.com/pytest-dev/pytest-mock/pull/235)st-mock/pull/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
.. https://github.com/pytest-dev/pytest-mock/pull/224pull/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
.. https://github.com/pytest-dev/pytest-mock/pull/221pull/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/webkn[https://github.com/pytest-dev/pytest-mock/pull/211](https://togithub.com/pytest-dev/pytest-mock/pull/211)t-mock/pull[https://github.com/pytest-dev/pytest-mock/issues/215](https://togithub.com/pytest-dev/pytest-mock/issues/215)-mock/issue[https://github.com/pytest-dev/pytest-mock/pull/216](https://togithub.com/pytest-dev/pytest-mock/pull/216)est-mock/pull/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
.. https://github.com/pytest-dev/pytest-mock/pull/201pull/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
.. https://github.com/pytest-dev/pytest-mock/pull/199pull/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
.. https://github.com/pytest-dev/pytest-mock/pull/197pull/197

v3.1.1

Compare Source

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

.. _#191:https://github.com/pytest-dev/pytest-mock/issues/1911

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
.. https://github.com/pytest-dev/pytest-mock/pull/182pull/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:https://github.com/pytest-dev/pytest-mock/issues/1799
.. _@​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:https://github.com/pytest-dev/pytest-mock/issues/1755

v1.13.0

Compare Source

  • The object returned by mocker.spy now also tracks any side effect
    of the spied method/function.

v1.12.1

Compare Source

  • Fix error if mocker.patch is used in code where the source file
    is not available, for example stale .pyc files (#169_).

.. _#169:https://github.com/pytest-dev/pytest-mock/issues/169#issuecomment-5557292655

v1.12.0

Compare Source

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

.. _@​AlexGascon: https://github.com/AlexGascon
.. https://github.com/pytest-dev/pytest-mock/pull/168pull/168

v1.11.2

Compare Source

  • 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_).

.. _#154:https://github.com/pytest-dev/pytest-mock/issues/1544
.. _#165https://github.com/pytest-dev/pytest-mock/pull/16565
.. _@​binarymason: https://github.com/binarymason

v1.11.1

Compare Source

  • Fix mocker.spy on Python 2 when used on non-function objects
    which implement __call__ (#157). Thanks @pbasista for
    the report.

.. _#157:https://github.com/pytest-dev/pytest-mock/issues/1577
.. _@​pbasista: https://github.com/pbasista

v1.11.0

Compare Source

  • The object returned by mocker.spy now also tracks the return value
    of the spied method/function.

v1.10.4

Compare Source

  • Fix plugin when 'terminal' plugin is disabled

v1.10.3

Compare Source

  • Fix test suite in Python 3.8. Thanks @hroncok_ for the report and @blueyed_ for the PR (#140_).

.. _#140:https://github.com/pytest-dev/pytest-mock/pull/1400
.. _@​hroncok: https://github.com/hroncok

v1.10.2

Compare Source

  • Fix bug at the end of the test session when a call to patch.stopall is done explicitly by
    user code. Thanks @craiga_ for the report (#137_).

.. _#137:https://github.com/pytest-dev/pytest-mock/issues/1377
.. _@​craiga: https://github.com/craiga

v1.10.1

Compare Source

  • Fix broken links and update README. Also the code is now formatted using black <https://github.com/ambv/black>__.

v1.10.0

Compare Source

  • Add support for the recently added assert_called method in Python 3.6 and mock-2.0. Thanks @rouge8_ for the PR (#115_).

.. _#115:https://github.com/pytest-dev/pytest-mock/pull/1155

v1.9.0

Compare Source

  • Add support for the recently added assert_called_once method in Python 3.6 and mock-2.0. Thanks @rouge8_ for the PR (#113_).

.. _#113:https://github.com/pytest-dev/pytest-mock/pull/1133

v1.8.0

Compare Source

  • Add aliases for NonCallableMock and create_autospec to mocker. Thanks @mlhamel_ for the PR (#111_).

.. _#111:https://github.com/pytest-dev/pytest-mock/pull/1111

v1.7.1

Compare Source

  • Fix setup.py to correctly read the README.rst. Thanks @ghisvail_ for the fix (#107_).

.. _#107:https://github.com/pytest-dev/pytest-mock/issues/1077

v1.7.0

Compare Source

Incompatible change

  • pytest-mock no longer supports Python 2.6 and Python 3.3, following the lead of
    pytest and other projects in the community. Thanks @hugovk_ for the PR (#96_).

Packaging

  • Fix mock requirement in Python 2. Thanks @ghisvail_ for the report (#101_).

Internal

  • Some tests in pytest-mock's suite are skipped if assertion rewriting is disabled (#102_).

.. _@​ghisvail: https://github.com/ghisvail
.. _@​hugovk: https://github.com/hu[https://github.com/pytest-dev/pytest-mock/pull/96](https://togithub.com/pytest-dev/pytest-mock/pull/96)st-mock/pul[https://github.com/pytest-dev/pytest-mock/issues/101](https://togithub.com/pytest-dev/pytest-mock/issues/101)-mock/issue[https://github.com/pytest-dev/pytest-mock/issues/102](https://togithub.com/pytest-dev/pytest-mock/issues/102)t-mock/issues/102

v1.6.3

Compare Source

  • Fix UnicodeDecodeError during assert introspection in assert_called_with in Python 2.
    Thanks @AndreasHogstrom_ for the report (#91_).

.. _@​AndreasHogstrom: https://github.com/AndreasHogstrom

.. _#91:https://github.com/pytest-dev/pytest-mock/issues/911

v1.6.2

Compare Source

  • Provide source package in tar.gz format and remove obsolete MANIFEST.in.

v1.6.1

Compare Source

  • Fix mocker.resetall() by ignoring mocker objects which don't have a
    resetall method, like for example patch.dict.
    Thanks @jdavisp3_ for the PR (#88_).

.. _@​jdavisp3: https://github.com/jdavisp3

.. _#88:https://github.com/pytest-dev/pytest-mock/pull/888

v1.6.0

Compare Source

  • The original assertions raised by the various Mock.assert_* methods
    now appear in the failure message, in addition to the message obtained from
    pytest introspection.
    Thanks @quodlibetor_ for the initial patch (#79_).

.. _@​quodlibetor: https://github.com/quodlibetor

.. _#79:https://github.com/pytest-dev/pytest-mock/pull/799

v1.5.0

Compare Source

  • New mocker.mock_module variable points to the underlying mock module being used
    (unittest.mock or mock).
    Thanks @blueyed_ for the request (#71_).

.. _#71:https://github.com/pytest-dev/pytest-mock/pull/711

v1.4.0

Compare Source

  • New configuration variable, mock_use_standalone_module (defaults to False). This forces
    the plugin to import mock instead of unittest.mock on Python 3. This is useful to import
    a newer version than the one available in the Python distribution.

  • Previously the plugin would first try to import mock and fallback to unittest.mock
    in case of an ImportError, but this behavior has been removed because it could hide
    hard to debug import errors (#68_).

  • Now mock (Python 2) and unittest.mock (Python 3) are lazy-loaded to make it possible to
    implement the new mock_use_standlone_module configuration option. As a consequence of this
    the undocumented pytest_mock.mock_module variable, which pointed to the actual mock module
    being used by the plugin, has been removed.

  • DEFAULT <https://docs.python.org/3/library/unittest.mock.html#default>_ is now available from
    the mocker fixture.

.. _#68:https://github.com/pytest-dev/pytest-mock/issues/688

v1.3.0

Compare Source

  • Add support for Python 3.6. Thanks @hackebrot_ for the report (#59_).

  • mock.mock_open is now aliased as mocker.mock_open for convenience.
    Thanks @pokidovea_ for the PR (#66_).

.. _@​hackebrot: https://github.com/hackebrot
.. _@​pokidovea: https://github.com/pokid[https://github.com/pytest-dev/pytest-mock/issues/59](https://togithub.com/pytest-dev/pytest-mock/issues/59)-mock/issu[https://github.com/pytest-dev/pytest-mock/pull/66](https://togithub.com/pytest-dev/pytest-mock/pull/66)est-mock/pull/66


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), 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 these updates again.


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

@mend-for-github-com mend-for-github-com bot force-pushed the whitesource-remediate/pytest-mock-3.x branch from f399e45 to f8659ea Compare June 16, 2023 01:31
@mend-for-github-com mend-for-github-com bot force-pushed the whitesource-remediate/pytest-mock-3.x branch from f8659ea to 422a063 Compare October 20, 2023 05:41
@mend-for-github-com mend-for-github-com bot force-pushed the whitesource-remediate/pytest-mock-3.x branch from 422a063 to c4b9d89 Compare March 22, 2024 05:58
@mend-for-github-com mend-for-github-com bot changed the title Update dependency pytest-mock to v3 [NEUTRAL] Update dependency pytest-mock to v3 Mar 22, 2024
@mend-for-github-com mend-for-github-com bot changed the title [NEUTRAL] Update dependency pytest-mock to v3 Update dependency pytest-mock to v3 Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants