[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):
    def tearDown(self):

c = C()

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>

More information about the Python-bugs-list mailing list