I am doing a unit test (using pytest) of a plot function that calls a plot method via mplfiance (essentially a candlestick plot using matplotlib).
I would like to path the call of the plot function in my test so that it wont actually create the graph. I would just like to see if the parameters are correct when i call the function.
For example
def plot_something(param1, param2):
# doing something with param1 and para2
param1 += 1
param2 *= 2
# below is the actual plotting where I would like to patch
make_plot(param1, param2)
def make_plot(param1, param2):
# make plot here
plot(param1, param2)
How can I create a test case to just make sure 1) both plot_something() and make_plot() are called. 2) the parameters are asserted 3) no actual graph is actually display on the screen?
I suppose patching is the way to go to replace make_plot() call with something in the test function. But I don't know how exactly.
Many thanks for your advice.