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.
app/mocking.py:
from app.my_module import get_user_name

def test_method():
return get_user_name()

if __name__ == “__main__”:
print “Starting Program…”
test_method()

app/my_module/__init__.py:
def get_user_name():
return “Unmocked User”

t….

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 all_test.py 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….