I have a function, Foo, and already used in Bar and some other places in the Python package. And for the unit test, I need to replace that function with fake_Foo. The fake_Foo should override every previous instance. How to do that?
I have tried Foo = fake_Foo and global Foo but it does not work.
TL;DR: I am trying to override _command function here with fake_command function here for every previous instance.