mocking for testing notice that the last patch' mock is passed into the second parameter passed to the test_something(method (self is the first parameter to all methodsin turn the first patch' mock is passed into the last parameter thus the mocks are passed into the test method in the reverse order to that which they are defined in how many mocksan interesting question to consider is how many mocks should you use per testthis is the subject or lot of debate within the software testing community the general rules of thumb around this topic are given belowhowever it should be borne in mind that these are guidelines rather than hard and fast rules avoid more than or mocks per test you should avoid more than - mocks as the mocks themselves the get harder to manage many also consider that if you need more then - mocks per test then there are probably some underlying design issues that need to be considered for exampleif you are testing python class then that class may have too many dependencies alternatively the class may have too many responsibilities and should be broken down into several independent classeseach with distinct responsibility another cause might be that the class' behaviour may not be encapsulated enough and that you are allowing other elements to interact with the class in more informal ways ( the interface between the class and other elements is not clean/exploit enoughthe result is that it may be necessary to refactor your class before progressing with your development and testing only mock you nearest neighbour you should only ever mock your nearest neighbour whether that is functionmethod or object you should try to avoid mocking dependencies of dependencies if you find yourself doing this then it will become harder to configuremaintainunderstand and develop it is also increasingly likely that you are testing the mocks rather than your own functionmethod or class mocking considerations the following provide some rules of thumb to consider when using mocks with your testsdon' over mock--if you do then you can end up just testing the mocks themselves