Skip to content

Commit 2de3e9a

Browse files
authored
Merge pull request #223 from nicoddemus/release-3.5.0
Update context-manager docs and prepare for 3.5.0
2 parents f623fa8 + cdd5d70 commit 2de3e9a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
3.5.0 (2021-01-04)
2+
------------------
3+
4+
* Now all patch functions will emit a warning instead of raising a ``ValueError`` when used
5+
as a context-manager. Thanks `@iforapsy`_ for the PR (`#221`_).
6+
7+
* Additionally, ``mocker.patch.context_manager`` is available when the user intends to mock
8+
a context manager (for example ``threading.Lock`` object), which will not emit that
9+
warning.
10+
11+
.. _@iforapsy: https://github.com/iforapsy
12+
.. _#221: https://github.com/pytest-dev/pytest-mock/pull/221
13+
114
3.4.0 (2020-12-15)
215
------------------
316

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ fixture:
261261
assert a.doIt() == True
262262
263263
The purpose of this plugin is to make the use of context managers and
264-
function decorators for mocking unnecessary.
264+
function decorators for mocking unnecessary, so it will emit a warning when used as such.
265+
266+
If you really intend to mock a context manager, ``mocker.patch.context_manager`` exists
267+
which won't issue the above warning.
265268

266269

267270
Requirements

0 commit comments

Comments
 (0)