/unit_tests/test_issue_101.py
Python | 27 lines | 20 code | 7 blank | 0 comment | 1 complexity | 30a85941adbbf16c4bcc5e64edf454b4 MD5 | raw file
1import sys 2import unittest 3import warnings 4from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin 5from nose.exc import SkipTest 6 7class TestErrorClassWithStringException(unittest.TestCase): 8 9 def test_string_exception_not_masked(self): 10 if sys.version_info >= (3,): 11 raise SkipTest("Python 3.x does not support string exceptions") 12 13 class X(Exception): 14 pass 15 16 class EP(ErrorClassPlugin): 17 xes = ErrorClass(X, label='XXX', isfailure=True) 18 19 warnings.filterwarnings(action='ignore', category=DeprecationWarning) 20 try: 21 22 raise "oh no!" 23 except: 24 exc = sys.exc_info() 25 26 ep = EP() 27 self.assertEqual(ep.addError(None, exc), None)