Karthikeyan Singaravelan added the comment:
I guess the problem is that to patch 'bar' in foo.bar the signature of bar is
taken and then it's evaluated using exec [1] where the function body has
_check_sig that checks for the signature during function call. _check_sig has
attributes of func c
New submission from Sam Park :
The expectation is that the __module__ attribute for a patched function should
persist after patching.
Minimal test case is attached. Simply run pytest in a venv with the files.
Output:
def test_zxc():
with mock.patch.object(mymodule, 'asd', side_effect=