[issue5316] Buildbot failures in test_site

Hirokazu Yamamoto report at bugs.python.org
Wed Feb 25 21:38:05 CET 2009


Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp> added the comment:

Probably attached patch will fix this issue. But this patch doesn't
cover other similar problematic codes.

It seems this is multi inheritance problem. Following code shows B.setUp
and B.tearDown are called twice respectively. (In this issue, B
represents PyPIRCCommandTestCase)

class A(object): # LoggingSilencer
    def setUp(self):
        print "A setup"
        super(A, self).setUp()
    def tearDown(self):
        print "A tearDown"
        super(A, self).tearDown()

class B: # PyPIRCCommandTestCase
    def setUp(self):
        print "B setup"
    def tearDown(self):
        print "B tearDown"

class C(A, B): # sdistTestCase
    def setUp(self):
        A.setUp(self)
        B.setUp(self)
    def tearDown(self):
        A.tearDown(self)
        B.tearDown(self)

c = C()
c.setUp()
c.tearDown()

"""
A setup
B setup
B setup # called twice
A tearDown
B tearDown
B tearDown # ditto
"""

P.S. This is first time I saw the behavior of super in multi
inheritance. Movement of code flaw is interesting and fresh for me. :-)

----------
keywords: +patch
nosy: +ocean-city
Added file: http://bugs.python.org/file13177/part_of_fix.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5316>
_______________________________________


More information about the Python-bugs-list mailing list