[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-30 Thread Kit Choi


Kit Choi  added the comment:

See issue38320 for documentation change request

--
nosy: +Kit Choi2

___
Python tracker 
<https://bugs.python.org/issue38296>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38320] Clarify unittest expectedFailure behaviour in the documentation

2019-09-30 Thread Kit Choi


New submission from Kit Choi :

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@python
components: Documentation, Tests
messages: 353557
nosy: Kit Choi2, docs@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 
<https://bugs.python.org/issue38320>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-27 Thread Kit Choi


New submission from Kit Choi :

I expect the following test to fail, because an "error" is not a "failure".
Unexpectedly, the test passes:

```
class TestFailure(unittest.TestCase):

@unittest.expectedFailure
def test_expected_failure(self):
raise TypeError()   # for example, a typo.
```

```
$ python -m unittest test_main
x
--
Ran 1 test in 0.000s

OK (expected failures=1)
```

This behaviour exists since Python 2.7, and is still true for the Python 3.8.0b1

--
components: Tests
messages: 353382
nosy: Kit Choi
priority: normal
severity: normal
status: open
title: unittest expectedFailure does not differentiate errors from failures
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue38296>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com