Recently, some buildbot failures have started appearing on trunk and py3k with the following error: ====================================================================== FAIL: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.x.klose-ubuntu-i386/build/Lib/test/test_site.py", line 105, in test_s_option self.assertEqual(rc, 1) AssertionError: 0 != 1 make: *** [buildbottest] Error 1
I manage to reproduce it by running test_site just after test_distutils: ./python -E -tt -m test.regrtest -uall -l -w test_distutils test_site It could be related to test_distutils modifying an environment variable without restoring it at the end.
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. :-)
right, subclasses must use super if their superclasses do. I'll apply Hirozaku patch (thanks). I might also simplify distutil base test class to avoid Mixins.