mock_makeDevBuild = MagicMock()

def mock_init(self, buildNum, configFile):
    self.config = MagicMock()
self.config.MakeDevBuild = mock_makeDevBuild
with patch('DevBuild.SuperDevBuild.__init__', new=mock_init):
    DevBuild('42')
mock_makeDevBuild.assert_called_once_with()
How do I mock a superclass's __init__ create an attribute containing a mock object for a unit test?