diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 169ebcf..3d908a8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,16 @@ +3.5.0 (2021-01-04) +------------------ + +* 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: https://github.com/pytest-dev/pytest-mock/pull/221 + 3.4.0 (2020-12-15) ------------------ diff --git a/README.rst b/README.rst index 5d4918b..7fb1ad2 100644 --- a/README.rst +++ b/README.rst @@ -261,7 +261,10 @@ fixture: assert a.doIt() == True The purpose of this plugin is to make the use of context managers and -function decorators for mocking unnecessary. +function decorators for mocking unnecessary, so it will emit a warning when used as such. + +If you really intend to mock a context manager, ``mocker.patch.context_manager`` exists +which won't issue the above warning. Requirements