Skip to content

Commit dcfc8ba

Browse files
committed
Add CHANGELOG for #165
1 parent 72f66b0 commit dcfc8ba

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
1.11.2 (unreleased)
1+
1.11.2 (2019-10-19)
22
-------------------
33

44
* The *pytest introspection follows* message is no longer shown
55
if there is no pytest introspection (`#154`_).
66
Thanks `@The-Compiler`_ for the report.
77

8+
* ``mocker`` now raises a ``TypeError`` when used as a context-manager.
9+
Thanks `@binarymason`_ for the PR (`#165`_).
10+
811
.. _#154: https://github.com/pytest-dev/pytest-mock/issues/154
12+
.. _#165: https://github.com/pytest-dev/pytest-mock/pull/165
13+
.. _@binarymason: https://github.com/binarymason
914

1015
1.11.1 (2019-10-04)
1116
-------------------

src/pytest_mock/plugin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def _enforce_no_with_context(self, stack):
166166
info = inspect.getframeinfo(frame)
167167
code_context = " ".join(info.code_context).strip()
168168

169-
if "with mocker" in code_context:
169+
if code_context.startswith("with mocker."):
170170
raise ValueError(
171171
"Using mocker in a with context is not supported. "
172172
"https://github.com/pytest-dev/pytest-mock#note-about-usage-as-context-manager"

0 commit comments

Comments
 (0)