Fix Python – Python Mocking a function from an imported module

I want to understand how to @patch a function from an imported module.
This is where I am so far.
from app.my_module import get_user_name

def test_method():
return get_user_name()

if __name__ == “__main__”:
print “Starting Program…”

def get_user_name():
return “Unmocked User”


Fix Python – How do I run all Python unit tests in a directory?

I have a directory that contains my Python unit tests. Each unit test module is of the form test_*.py. I am attempting to make a file called that will, you guessed it, run all files in the aforementioned test form and return the result. I have tried two methods so far; both have failed. I will show the two methods, and I hope someone o….