[New-bugs-announce] [issue38320] Clarify unittest expectedFailure behaviour in the documentation

Kit Choi report at bugs.python.org
Mon Sep 30 05:14:01 EDT 2019

New submission from Kit Choi <kchoi at enthought.com>:

Following discussion in https://bugs.python.org/issue38296

The docstring of unittest.expectedFailure is misleading for people who differentiate "error" and "failure" when they read the sentence. This has a consequence of developers using the decorator without noticing unexpected errors are also silenced, which mean running a risk of their tests becoming unmaintained and invalid in the future.

I suggest updating the documentation to include a mention of the current behaviour of silencing unexpected errors, so that developers are aware of this.

Something like this?:

Mark the test such that unexpected success results in a failure. If an exception (BaseException excluding KeyboardInterrupt) occurs, the test will be considered a success. If the test passes, it will be considered a failure.

assignee: docs at python
components: Documentation, Tests
messages: 353557
nosy: Kit Choi2, docs at python
priority: normal
severity: normal
status: open
title: Clarify unittest expectedFailure behaviour in the documentation
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list