Skip to content

Commit

Permalink
Add "where to patch" link to the docs
Browse files Browse the repository at this point in the history
As #386 shows, this is a common problem, so add a link to the docs to help users.
  • Loading branch information
nicoddemus authored Oct 6, 2023
1 parent 91229f9 commit ea1d0a6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,10 @@ function decorators for mocking unnecessary, so it will emit a warning when used

If you really intend to mock a context manager, ``mocker.patch.context_manager`` exists
which won't issue the above warning.

Where to patch
--------------

A common issue where mocking appears not to be working is patching in the wrong place.

See this `section in the unittest docs <unittest https://docs.python.org/3/library/unittest.mock.html#where-to-patch>`__ which provides a comprehensive explanation.

0 comments on commit ea1d0a6

Please sign in to comment.