/unit_tests/test_issue_101.py
https://bitbucket.org/jpellerin/nose/ · Python · 27 lines · 20 code · 7 blank · 0 comment · 2 complexity · 30a85941adbbf16c4bcc5e64edf454b4 MD5 · raw file
- import sys
- import unittest
- import warnings
- from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
- from nose.exc import SkipTest
- class TestErrorClassWithStringException(unittest.TestCase):
- def test_string_exception_not_masked(self):
- if sys.version_info >= (3,):
- raise SkipTest("Python 3.x does not support string exceptions")
- class X(Exception):
- pass
- class EP(ErrorClassPlugin):
- xes = ErrorClass(X, label='XXX', isfailure=True)
- warnings.filterwarnings(action='ignore', category=DeprecationWarning)
- try:
- raise "oh no!"
- except:
- exc = sys.exc_info()
-
- ep = EP()
- self.assertEqual(ep.addError(None, exc), None)