patching a class yields “AttributeError: Mock object has no attribute” when accessing instance attributes
No, autospeccing cannot mock out attributes set in the __init__ method of the original class (or in any other method). It can only mock out static attributes, everything that can be found on the class. Otherwise, the mock would have to create an instance of the class you tried to replace with a mock in … Read more