uber/doubles

allow_constructor does not work when importing using from

achiinto opened this issue · 1 comments

When importing a class either in test or in code like this:

'''
from lib.sub_lib.class_path import ClassName
'''

The allow_constructor on patch_class does not seem to be triggered. Using "import" would seems to generate more ugly Class referencing.

I am kind of new to python, am I doing something wrong? Or is this a bug?

@achiinto this a limitation of how import works in python. Here is a good explanation of why it happens [here ](https://docs.python.org/3/library/unittest.mock.html#where-to-patch.