[New-bugs-announce] [issue18566] In unittest.TestCase docs for setUp() and tearDown() don't mention AssertionError

py.user report at bugs.python.org
Sat Jul 27 07:12:17 CEST 2013


New submission from py.user:

http://docs.python.org/3/library/unittest.html#unittest.TestCase.setUp
"any exception raised by this method will be considered an error rather than a test failure"

http://docs.python.org/3/library/unittest.html#unittest.TestCase.tearDown
"Any exception raised by this method will be considered an error rather than a test failure."


utest.py

#!/usr/bin/env python3

import unittest

class Test(unittest.TestCase):
    
    def setUp(self):
        raise AssertionError

    def tearDown(self):
        raise AssertionError
    
    def test_nothing(self):
        pass



[guest at localhost py]$ python3 -m unittest -v utest
test_nothing (utest.Test) ... FAIL

======================================================================
FAIL: test_nothing (utest.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./utest.py", line 8, in setUp
    raise AssertionError
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (failures=1)
[guest at localhost py]$


also raising unittest.SkipTest works properly

----------
assignee: docs at python
components: Documentation
messages: 193772
nosy: docs at python, py.user
priority: normal
severity: normal
status: open
title: In unittest.TestCase docs for setUp() and tearDown() don't mention AssertionError
type: enhancement
versions: Python 3.4

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


More information about the New-bugs-announce mailing list