Fix issue 9926. TestSuite subclasses that override __call__ are called correctly.

This commit is contained in:
Michael Foord 2010-11-01 21:09:03 +00:00
parent e6fa3811f7
commit bbea35f194
3 changed files with 32 additions and 19 deletions

View file

@ -345,5 +345,19 @@ class Test_TestSuite(unittest.TestCase, TestEquality):
self.assertEqual(result.testsRun, 2)
def test_overriding_call(self):
class MySuite(unittest.TestSuite):
called = False
def __call__(self, *args, **kw):
self.called = True
unittest.TestSuite.__call__(self, *args, **kw)
suite = MySuite()
wrapper = unittest.TestSuite()
wrapper.addTest(suite)
wrapper(unittest.TestResult())
self.assertTrue(suite.called)
if __name__ == '__main__':
unittest.main()