I have an import statement inside a function and I want to mock that import statement using patch, but couldn't.
class A():
"""mock object"""
@staticmethod
def run():
print('ran')
@patch('something')
def test_run(self, something):
something = A()
# my function has this statement
from something import run
run(....)
got
E TypeError: Need a valid target to patch. You supplied: 'something'