diff -r c0b0e7aef360 Lib/unittest/result.py --- a/Lib/unittest/result.py Tue Jan 07 23:29:19 2014 -0700 +++ b/Lib/unittest/result.py Wed Jan 08 01:26:22 2014 -0800 @@ -156,11 +156,16 @@ self.unexpectedSuccesses.append(test) def wasSuccessful(self): - "Tells whether or not this result was a success" - return len(self.failures) == len(self.errors) == 0 + """Tells whether or not this result was a success.""" + # The hasattr check is for test_result's OldResult test. That + # way this method works on objects that lack the attribute. + # (where would such result intances come from? old stored pickles?) + return ((len(self.failures) == len(self.errors) == 0) and + (not hasattr(self, 'unexpectedSuccesses') or + len(self.unexpectedSuccesses) == 0)) def stop(self): - "Indicates that the tests should be aborted" + """Indicates that the tests should be aborted.""" self.shouldStop = True def _exc_info_to_string(self, err, test): diff -r c0b0e7aef360 Lib/unittest/test/test_skipping.py --- a/Lib/unittest/test/test_skipping.py Tue Jan 07 23:29:19 2014 -0700 +++ b/Lib/unittest/test/test_skipping.py Wed Jan 08 01:26:22 2014 -0800 @@ -158,7 +158,7 @@ ['startTest', 'addUnexpectedSuccess', 'stopTest']) self.assertFalse(result.failures) self.assertEqual(result.unexpectedSuccesses, [test]) - self.assertTrue(result.wasSuccessful()) + self.assertFalse(result.wasSuccessful()) def test_unexpected_success_subtests(self): # Success in all subtests counts as the unexpected success of @@ -182,7 +182,7 @@ 'addUnexpectedSuccess', 'stopTest']) self.assertFalse(result.failures) self.assertEqual(result.unexpectedSuccesses, [test]) - self.assertTrue(result.wasSuccessful()) + self.assertFalse(result.wasSuccessful()) def test_skip_doesnt_run_setup(self): class Foo(unittest.TestCase):