[issue38296] unittest expectedFailure does not differentiate errors from failures
Terry J. Reedy
report at bugs.python.org
Sat Sep 28 14:29:40 EDT 2019
Terry J. Reedy <tjreedy at udel.edu> added the comment:
A test either passes or fails. Like a not operator, the expectedFailure decorator inverts the result.
https://docs.python.org/3/library/unittest.html#unittest.expectedFailure
@unittest.expectedFailure
Mark the test as an expected failure. If the test fails it will be considered a success. If the test passes, it will be considered a failure.
By itself, your 'test' method fails. Decorated, it should and does pass.
As you suggested, using expectedFailure is a blunt instrument that can be misleading if not used carefully and not reviewed when editing the module tested. It is only used 7 times in test_xyz.py modules in the lib/test directory and subdirectories.
----------
nosy: +ezio.melotti, michael.foord
versions: -Python 3.5, Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38296>
_______________________________________
More information about the Python-bugs-list
mailing list