From 7a1901f86129dc15dc9004da02907eb1c90f32fa Mon Sep 17 00:00:00 2001 From: Michael Foord Date: Fri, 28 Sep 2012 14:14:03 +0100 Subject: [PATCH] Closes issue #12376 : Pass on parameters in unittest.TextTestResult.__init__ super call --- Lib/unittest/runner.py | 2 +- Lib/unittest/test/test_runner.py | 13 +++++++++++++ Misc/NEWS | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Lib/unittest/runner.py b/Lib/unittest/runner.py index 10c47784340..28b8865978a 100644 --- a/Lib/unittest/runner.py +++ b/Lib/unittest/runner.py @@ -35,7 +35,7 @@ class TextTestResult(result.TestResult): separator2 = '-' * 70 def __init__(self, stream, descriptions, verbosity): - super(TextTestResult, self).__init__() + super(TextTestResult, self).__init__(stream, descriptions, verbosity) self.stream = stream self.showAll = verbosity > 1 self.dots = verbosity == 1 diff --git a/Lib/unittest/test/test_runner.py b/Lib/unittest/test/test_runner.py index 8e95410e9ee..aed1e76940a 100644 --- a/Lib/unittest/test/test_runner.py +++ b/Lib/unittest/test/test_runner.py @@ -149,6 +149,19 @@ class Test_TextTestRunner(unittest.TestCase): self.assertEqual(runner.resultclass, unittest.TextTestResult) + def test_multiple_inheritance(self): + class AResult(unittest.TestResult): + def __init__(self, stream, descriptions, verbosity): + super(AResult, self).__init__(stream, descriptions, verbosity) + + class ATextResult(unittest.TextTestResult, AResult): + pass + + # This used to raise an exception due to TextTestResult not passing + # on arguments in its __init__ super call + ATextResult(None, None, 1) + + def testBufferAndFailfast(self): class Test(unittest.TestCase): def testFoo(self): diff --git a/Misc/NEWS b/Misc/NEWS index 26d0134e4da..cb1df24f5a5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -123,6 +123,8 @@ Core and Builtins Library ------- +- Issue #12376: Pass on parameters in TextTestResult.__init__ super call + - Issue #15222: Insert blank line after each message in mbox mailboxes - Issue #16013: Fix CSV Reader parsing issue with ending quote characters.