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 context-manager docs and prepare for 3.5.0 #223

Merged
merged 1 commit into from Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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