New submission from alexander.sturm: In the following example code, a SystemExit is raised in setUpClass of a unittest.TestCase, which causes the python instance to terminate. This behavior is inconsistent with how SystemExit is handled in other places (e.g. in setUp/tearDown methods, or in actual test methods), where it is caught by unittest to prevent termination. See also issue #10611.
import unittest class Test(unittest.TestCase): @classmethod def setUpClass(cls): raise SystemExit() def test_something(self): pass result = unittest.TestResult() suite = unittest.TestSuite() suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(Test)) suite.run(result) print result ---------- components: Library (Lib) messages: 273430 nosy: alexander.sturm priority: normal severity: normal status: open title: SystemExit in setUpClass etc. terminates test run type: behavior versions: Python 2.7, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27835> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com