I am trying to use methods patchin my api bulb, but it seems that the method call is not replaced. Does app.test_client()something under the hood that I miss.
For example, if I run
@patch('k.stats.mstats')
def test_ps(self, mstats):
mstats.return_value = (1, 2, 3)
rv = self.app.get('/ps/')
and I go through the debugger to the point below:
@app.route('/ps/', methods=['GET'])
def ps():
import pdb
pdb.set_trace()
mstats()
and by checking mstats, I will return the function that will be removed.
However, if I run from k.stats import mstatsthe breakpoint, I return the bullying method that I am looking for.
How to ensure that the called method is called?
source
share