How to mock a readonly property with mock?
I think the better way is to mock the property as PropertyMock, rather than to mock the __get__ method directly. It is stated in the documentation, search for unittest.mock.PropertyMock: A mock intended to be used as a property, or other descriptor, on a class. PropertyMock provides __get__ and __set__ methods so you can specify a … Read more