Hirokazu Yamamoto <ocean-c...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue5316>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to