This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Kit Choi, terry.reedy
Date 2019-09-27.21:00:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569618016.93.0.190006288333.issue38296@roundup.psfhosted.org>
In-reply-to
Content
A function can fail to return an expected object by either returning a wrong object or raising an (unexpected) exception.  The assertXyz methods, which ultimately raise AssertionError or something similar, are mostly about catching the first kind of failure, but tests should also catch and report the second kind.  The traceback shows the kind of failure.  The assertXyx failures add additional details after the traceback.


import unittest

class T(unittest.TestCase):
    def test_f(self): raise TypeError()

unittest.main()

# Properly results in

Traceback (most recent call last):
  File "F:\Python\a\tem4.py", line 4, in test_f
    def test_f(self): raise TypeError()
TypeError

----------------------------------------------------------------------
Ran 1 test in 0.050s

FAILED (errors=1)
History
Date User Action Args
2019-09-27 21:00:16terry.reedysetrecipients: + terry.reedy, Kit Choi
2019-09-27 21:00:16terry.reedysetmessageid: <1569618016.93.0.190006288333.issue38296@roundup.psfhosted.org>
2019-09-27 21:00:16terry.reedylinkissue38296 messages
2019-09-27 21:00:16terry.reedycreate