I know how to mock methods in Python using flexmock, like
flexmock(subprocess).should_receive('call').replace_with(my_func)
How does one mock functions outside objects, or for example glob
, which was imported via from glob import glob
instead of import glob
?
I have found mocking functions using python mock as a similar question, but it doesn't answer my question.