[issue20165] unittest TestResult wasSuccessful returns True when there are unexpected successes

Gregory P. Smith report at bugs.python.org
Tue Jan 7 20:25:21 CET 2014


New submission from Gregory P. Smith:

Python 3.3.3+ (3.3:28337a8fb502+, Jan  7 2014, 01:32:44)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import unittest
>>> r = unittest.result.TestResult()
>>> r.wasSuccessful()
True
>>> r.addUnexpectedSuccess("weird!")
>>> r.wasSuccessful()
True

An unexpected success is not a good thing and indicates a problem.

the wasSuccessful() method should include a check for len(self.unexpectedSuccesses) == 0 as part of its condition.

----------
assignee: gregory.p.smith
messages: 207582
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: unittest TestResult wasSuccessful returns True when there are unexpected successes
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20165>
_______________________________________


More information about the Python-bugs-list mailing list