(i’m a python newbie)
I was looking at: Mocking out objects and methods
And I was wondering if i can replace an object in a python method which is not passed as a parameter, lets say my method is like this:
def mypymethod(param1)
myresult = os.path.something
return myresult
and i wish to test mypymethod however i wish os.path at this case to return “yourmockresult” when i call it from my test method
anyway i can do this?
thanks!!
You should use Michael Foord’s Mock module for the same.
From the documentation: