Stub function from module
Lets you want to test module(module1) which imports function from another module:
from module2 import some_function
some_function()
To stub this function in test you should do something like this:
import module1
module1.module2.some_function = fake_function
Written by Oleg Potapov
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#