Skip to content

Commit f019696

Browse files
authored
Merge pull request #387 from pytest-dev/where-to-patch-link
Add "where to patch" link to the docs
2 parents 09f1814 + cec59a0 commit f019696

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/usage.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,12 @@ function decorators for mocking unnecessary, so it will emit a warning when used
157157

158158
If you really intend to mock a context manager, ``mocker.patch.context_manager`` exists
159159
which won't issue the above warning.
160+
161+
Where to patch
162+
--------------
163+
164+
A common issue where mocking appears not to be working is patching in the wrong place.
165+
166+
See this `section in the unittest docs <https://docs.python.org/3/library/unittest.mock.html#where-to-patch>`__ which provides a comprehensive explanation.
167+
168+
Also see this excellent blog post: `Why your mock doesn't work <https://nedbatchelder.com/blog/201908/why_your_mock_doesnt_work.html>`__.

0 commit comments

Comments
 (0)