Skip to content

Commit

Permalink
Merge pull request #223 from nicoddemus/release-3.5.0
Browse files Browse the repository at this point in the history
Update context-manager docs and prepare for 3.5.0
  • Loading branch information
nicoddemus committed Jan 4, 2021
2 parents f623fa8 + cdd5d70 commit 2de3e9a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions 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)
------------------

Expand Down
5 changes: 4 additions & 1 deletion README.rst
Expand Up @@ -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
Expand Down

0 comments on commit 2de3e9a

Please sign in to comment.