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@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@localhost py]$


also raising unittest.SkipTest works properly

----------
assignee: docs@python
components: Documentation
messages: 193772
nosy: docs@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue18566>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to