[TIP] failing tests after upgrading Mock 0.7 to 0.8

Eric Rasmussen ericrasmussen at gmail.com
Mon Nov 19 16:53:42 PST 2012


Hello,

I am upgrading from Mock 0.7 and it looks like there was a backwards
incompatible change in 0.8: it's apparently no longer possible to create a
class inheriting from Mock unless you call the super method. Can someone
explain why the below works in 0.7 but not in 0.8 and above?

class MyMock(Mock):
    def __init__(self, name):
        self.name = name

Now I have to write:

class MyMock(Mock):
    def __init__(self, name):
        Mock.__init__(self)
        self.name = name

I did find an issue here: http://code.google.com/p/mock/issues/detail?id=161

But it does not mention the reason for the change. I was unable to find any
mention of a backwards incompatible change of this nature in the changelog,
which is concerning. I just want to make sure I fully understand the scope
of the change. If you can point me to any documentation or pull requests
that show when and why this change was made that would be an enormous help.

It's really important for a project I'm working on that we document this
new requirement for creating a subclass of Mock, so I appreciate any
insight you can offer.

Thank you,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20121119/4b972a8f/attachment.htm>


More information about the testing-in-python mailing list