[New-bugs-announce] [issue38296] unittest expectedFailure does not differentiate errors from failures

Kit Choi report at bugs.python.org
Fri Sep 27 13:26:09 EDT 2019


New submission from Kit Choi <kit at kychoi.org>:

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 <report at bugs.python.org>
<https://bugs.python.org/issue38296>
_______________________________________


More information about the New-bugs-announce mailing list