File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 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
10151.11.1 (2019-10-04)
1116-------------------
Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments