Skip to content

Commit

Permalink
Update context-manager docs and prepare for 3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jan 4, 2021
1 parent f623fa8 commit cdd5d70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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 cdd5d70

Please sign in to comment.